Re: New elements vs. Trident

2007-09-16 19:01:53 +0200 Dean Edwards <dean@edwards.name>:
> Maciej Stachowiak wrote:

>> anyone from Microsoft comment on the possibility of fixing the
>> handling of unknown elements in IE, [...]
> 
> For XHTML you can mark up new elements like this:
> 
> <html:newelement><em>some text</em></html:newelement>

For HTML, you can do the same.

Namespace aware HTML browsers (that is: only IE) will see 
<html:newelement> as <newelement>, whereas Opera, WebKit, Mozilla will 
see <html:newelement> as - well - <html:newelement>.

On 2007-09-17 02:20:59 +0200 Dean Edwards <dean@edwards.name> wrote:
> Robert Burns wrote:
>> Is that for IE? Or does that work in any browser [...]?
> 
> It will work cross-browser if it is marked up as above.
> 
> To style the new element you have to use namespace aware CSS. 
> Annoyingly, IE 
> requires the namespace delimiter to be escaped:
> 
> html\:newelement { /* some style */ }

For HTML, that selector will work in Opera, WebKit and Mozilla as well.

Apparently, without the escaped delimter, those browsers would see it 
as some kind of pseudo-element/pseudo-class selector. But when you add 
the \, then the colon delimiter will be read literally.Thus,

	html\:newelement{} 	

will select <newelement> in Internet Explorer, whereas in the other 
big 3 browsers, the same selector will select <html:newelement>. Hence 
I think we have here a solution which will work reasonably well 
without any scripting in current UAs.

I made an [example page in Live DOM Viewer] of how this could work for 
the FIGURE element.

[example page in Live DOM Viewer]: <http://tinyurl.com/2wwv8l>
-- 
leif halvard silli

Received on Sunday, 23 September 2007 07:37:15 UTC