From: Andrew Poulos on 4 Jan 2010 00:24 In IE 8 running in standards mode with this HTML <img id="z012" alt="Fish" title="Japanese fish print" src="images/old-print-fish.jpg" style="-ms-filter:'alpha(opacity=0)'; filter:alpha(opacity=0); opacity:0; position:absolute; left:0px; top:0px; width:396px; height:272px;"> and this js var elem = document.getElementById("z012"); alert(typeof elem.style["-ms-filter"]) // this gives undefined alert(typeof elem.style["filter"]) // this gives string If I delete 'ms-filter' from the HTML the two alerts still give the same response. Here <url: http://msdn.microsoft.com/en-us/library/ms530752%28VS.85%29.aspx > it says that to script for -ms-filter I'm to use object.style.filter So does that mean there's no point checking if -ms-filter is supported? Andrew Poulos
From: Thomas 'PointedEars' Lahn on 4 Jan 2010 00:39 Andrew Poulos wrote: > In IE 8 running in standards mode with this HTML > > <img > id="z012" > alt="Fish" > title="Japanese fish print" > src="images/old-print-fish.jpg" > style="-ms-filter:'alpha(opacity=0)'; > filter:alpha(opacity=0); > opacity:0; > position:absolute; > left:0px; top:0px; width:396px; height:272px;"> Sigh. [psf 10.1] Have you still not gotten the concept of hiding proprietary extensions with Conditional Comments? > [...]and this js > > var elem = document.getElementById("z012"); > > alert(typeof elem.style["-ms-filter"]) // this gives undefined It should. After all, the `z-index' CSS declaration can be accessed with the `zIndex' property, so the `MsFilter' property access should be successful here instead. > alert(typeof elem.style["filter"]) // this gives string As it is the equivalent for `elem.style.string'. You are not dealing with a collection here, though, so for static referencing dots should be preferred. > If I delete 'ms-filter' from the HTML the two alerts still give the same > response. > > Here > <url: http://msdn.microsoft.com/en-us/library/ms530752%28VS.85%29.aspx > > it says that to script for -ms-filter I'm to use object.style.filter Could be a copy-paste error. Depends on whether the declaration is already there: if no, `style.filter' should work in all IEs; if yes, you better use `filters'. Told you. > [...] there's no point checking if -ms-filter is supported? Yes, and there is no point using it for the time being. Told you. PointedEars -- var bugRiddenCrashPronePieceOfJunk = ( navigator.userAgent.indexOf('MSIE 5') != -1 && navigator.userAgent.indexOf('Mac') != -1 ) // Plone, register_function.js:16
From: Thomas 'PointedEars' Lahn on 4 Jan 2010 00:41 Thomas 'PointedEars' Lahn wrote: > Andrew Poulos wrote: >> [...] and this js >> >> var elem = document.getElementById("z012"); >> >> [...]- >> alert(typeof elem.style["filter"]) // this gives string > > As it is the equivalent for `elem.style.string'. You've got me confused here. It is the equivalent for `elem.style.filter', of course. But: > You are not dealing with a collection here, though, so for static > referencing dots should be preferred. PointedEars
From: Andrew Poulos on 4 Jan 2010 03:12 On 4/01/2010 4:39 PM, Thomas 'PointedEars' Lahn wrote: > Andrew Poulos wrote: > >> In IE 8 running in standards mode with this HTML >> >> <img >> id="z012" >> alt="Fish" >> title="Japanese fish print" >> src="images/old-print-fish.jpg" >> style="-ms-filter:'alpha(opacity=0)'; >> filter:alpha(opacity=0); >> opacity:0; >> position:absolute; >> left:0px; top:0px; width:396px; height:272px;"> > > Sigh. [psf 10.1] > > Have you still not gotten the concept of hiding proprietary extensions with > Conditional Comments? Are you saying to use Conditional Comments and javascript to inject proprietary extensions or that I should have at least two versions of the HTML: one with proprietary extensions and one without? >> [...]and this js >> >> var elem = document.getElementById("z012"); >> >> alert(typeof elem.style["-ms-filter"]) // this gives undefined > > It should. After all, the `z-index' CSS declaration can be accessed with > the `zIndex' property, so the `MsFilter' property access should be > successful here instead. I tried MsFilter and msFilter and both returned undefined. >> alert(typeof elem.style["filter"]) // this gives string > > As it is the equivalent for `elem.style.string'. You are not dealing with > a collection here, though, so for static referencing dots should be > preferred. > >> If I delete 'ms-filter' from the HTML the two alerts still give the same >> response. >> >> Here >> <url: http://msdn.microsoft.com/en-us/library/ms530752%28VS.85%29.aspx> >> it says that to script for -ms-filter I'm to use object.style.filter > > Could be a copy-paste error. Depends on whether the declaration is already > there: if no, `style.filter' should work in all IEs; if yes, you better use > `filters'. Told you. The declaration is already there and filter (no "s") appears to work fine. >> [...] there's no point checking if -ms-filter is supported? > > Yes, and there is no point using it for the time being. Told you. Ok. Andrew Poulos
From: Thomas 'PointedEars' Lahn on 4 Jan 2010 05:04 Andrew Poulos wrote: > Thomas 'PointedEars' Lahn wrote: >> Andrew Poulos wrote: >>> In IE 8 running in standards mode with this HTML >>> >>> <img >>> id="z012" >>> alt="Fish" >>> title="Japanese fish print" >>> src="images/old-print-fish.jpg" >>> style="-ms-filter:'alpha(opacity=0)'; >>> filter:alpha(opacity=0); >>> opacity:0; >>> position:absolute; >>> left:0px; top:0px; width:396px; height:272px;"> >> >> Sigh. [psf 10.1] >> >> Have you still not gotten the concept of hiding proprietary extensions >> with Conditional Comments? > > Are you saying to use Conditional Comments and javascript to inject > proprietary extensions or that I should have at least two versions of > the HTML: one with proprietary extensions and one without? No, you should use Conditional Comments to include stylesheets that declare values for proprietary style properties. >>> [...] and this js >>> >>> var elem = document.getElementById("z012"); >>> >>> alert(typeof elem.style["-ms-filter"]) // this gives undefined >> >> It should. After all, the `z-index' CSS declaration can be accessed >> with the `zIndex' property, so the `MsFilter' property access should >> be successful here instead. > > I tried MsFilter and msFilter and both returned undefined. Shame on M$ then. >>> If I delete 'ms-filter' from the HTML the two alerts still give the >>> same response. >>> >>> Here >>> <url: http://msdn.microsoft.com/en-us/library/ms530752%28VS.85%29.aspx> >>> it says that to script for -ms-filter I'm to use object.style.filter >> >> Could be a copy-paste error. Depends on whether the declaration is >> already there: if no, `style.filter' should work in all IEs; if yes, you >> better use `filters'. Told you. > > The declaration is already there and filter (no "s") appears to work > fine. Depends on what you want to accomplish, of course. But since you do not want to declare proprietary style properties inline, you would use either `e.filters' or `e.currentStyle.filter' or `e.runtimeStyle.filter', not `e.style.filter' in that case. PointedEars -- realism: HTML 4.01 Strict evangelism: XHTML 1.0 Strict madness: XHTML 1.1 as application/xhtml+xml -- Bjoern Hoehrmann
|
Next
|
Last
Pages: 1 2 Prev: FAQ Topic - What is Ajax? (2010-01-04) Next: Some Javascript newbie questions |