One of my favorite mechanisms to do IE-specific CSS is to use the so-called dynamic properties available to IE5+ browsers. Firefox and Opera ignore these tags, so if, for instance you need a div of id "foo" to be 110 pixels in IE and 100 pixels in all other browsers, you would just do this:
#foo {
width: 100px;
width: expression('110px');
}
I spent the better part of the day trying to track down a Line 0. Object Required Javascript bug that, when hit, required me to close IE using Task Manager. I could not figure this one out and finally resorted to reconstructing the entire page, line-by-line until I found the problem.
I finally determined it occurred only when I added a <textarea> tag to the page. My current project is a Ruby on Rails app, which necessarily indludes the Prototype Library, so I initally wrote off this weirdity to the vagaries of Prototype and its many tens of thousands of lines of code.
In this context, an input type=text tag would do fine, so I switched to that and moved on.
Quite by accident, I stumbled across this section in my CSS file:
.WordBubble textarea {
overflow:hidden;
border:solid 1px lightBlue;
height:30px;
width:expression(document.getElementById('WordBubble').offsetWidth-66);
}
And WHALA, the answer!
Thinking to reuse a WordBalloon construct I had developed, I had modified this CSS to play off of .WordBubble the className vs the original #WordBubble the ID. Therefore, when I used the original:
<div id="WordBubble" class="WordBubble">
<textarea>
</div>
things worked as expected.
However, when using:
<div id="AnotherWordBubble" class="WordBubble">
<textarea>
</div>
The CSS, when evaluating the dynamic property, could not find "WordBubble" as it did not exist.
Although I realize this posting is somewhat confusing (I barely understand it myself), what I am trying to say is "When you get a Line 0, Object Expected" Javascript error and can't figure out where it comes from, check your CSS for Expression use.
Shannon
Friday, September 5, 2008
Subscribe to:
Posts (Atom)