WHATWG HTML5 Forums Forum Index WHATWG HTML5 Forums
A Forum for HTML5 Discussions: Semantics, DOM APIs, Microdata, Canvas, WebGL, Offline Web Applications, Local Storage, WebM Video, WebSockets, Web Workers, HTML5 Drag and Drop, HTML5 Forms, Accessibility, Syntax, News, Keywords, Yet More Keywords & More.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Unrecognised markup should be scriptable and stylable

 
Post new topic   Reply to topic    WHATWG HTML5 Forums Forum Index -> Feedback on the specs
View previous topic :: View next topic  
Author Message
Cerbera
<h5>


Joined: 21 Feb 2007
Posts: 34

PostPosted: Mon May 14, 2007 4:46 am    Post subject: Unrecognised markup should be scriptable and stylable Reply with quote

Currently, the market leading browser (Internet Explorer) does not apply CSS to unrecognised elements. Also, its DOM is somewhat messed up for elements which are not recognised.

In Firefox, CSS is applied to unrecognised elements. AFAICT, the DOM they produce is correct. This seems like a useful feature, particularly as HTML specifications usually add some new elements with each update.

I would propose that an HTML5 UA should treat unrecognised elements in such a way that they respond to CSS and are added to the DOM sanely (e.g. future sectioning and grouping elements). I would also propose that unrecognised attributes be selectable via CSS and work in the DOM (e.g. future type values for <input>).

This would make HTML5 UAs more forwards compatible. If more elements and attributes are added to HTML at a later time, they would more or less work in HTML5 UAs. Firefox already seems to implement this, as mentioned.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Xano
<small>


Joined: 11 May 2007
Posts: 5
Location: Almelo, The Netherlands

PostPosted: Mon May 14, 2007 7:12 am    Post subject: Reply with quote

Makes sense to me, just like you say it.

On the other hand, what is exactly is the use of such a feature? The one browser that doesn't support new stuff within a reasonably short period after 'release' would be Internet Explorer and I wouldn't count on its developers implement this forward-compatibility feature.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
zcorpan
<h1>


Joined: 06 Feb 2007
Posts: 444
Location: Sweden

PostPosted: Mon May 14, 2007 11:40 am    Post subject: Re: Unrecognised markup should be scriptable and stylable Reply with quote

Cerbera wrote:
I would propose that an HTML5 UA should treat unrecognised elements in such a way that they respond to CSS and are added to the DOM sanely (e.g. future sectioning and grouping elements). I would also propose that unrecognised attributes be selectable via CSS and work in the DOM (e.g. future type values for <input>).
This is already the case as specced.
Back to top
View user's profile Send private message MSN Messenger
Cerbera
<h5>


Joined: 21 Feb 2007
Posts: 34

PostPosted: Tue May 15, 2007 12:36 am    Post subject: Reply with quote

Sorry, I hadn't noticed it in the spec. Looking again, I've now spotted this:
WHATWG wrote:
When the steps below require the UA to create an element for a token, the UA must create a node implementing the interface appropriate for the element type corresponding to the tag name of the token [...], with the tag name being the name of that element, with the node being in the HTML namespace, and with the attributes on the node being those given in the given token.

[...]

The interface appropriate for an element that is not defined in this specification is HTMLElement.

(Source: 8.2.4.3.3. Creating and inserting HTML elements.)
So I guess that's the part which specifies that unrecognised elements and attributes must be added to the DOM and work sanely?
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
zcorpan
<h1>


Joined: 06 Feb 2007
Posts: 444
Location: Sweden

PostPosted: Tue May 15, 2007 1:11 am    Post subject: Reply with quote

Hmm, yeah but you probably also want to look for "Anything else" in various places in the tree construction section.

You also mentioned attribute values, which are just inserted as specified per HTML5. So <input type=foo> will have the value "foo", but still be treated as if it was "text".
Back to top
View user's profile Send private message MSN Messenger
Cerbera
<h5>


Joined: 21 Feb 2007
Posts: 34

PostPosted: Tue May 15, 2007 2:39 am    Post subject: Reply with quote

Thanks for that. Never simple, is it? Smile

So if this markup were used in an HTML5 document:
Code:
<input type=foo>
And if this CSS was linked to that document:
Code:
input[type=foo] {
 background: lime;
}
Would the CSS be applied to that element? I'm guessing it would, but that a UA would have created a text input (rather than a "foo" input) if the type was not a known value.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
zcorpan
<h1>


Joined: 06 Feb 2007
Posts: 444
Location: Sweden

PostPosted: Tue May 15, 2007 9:07 am    Post subject: Reply with quote

Cerbera wrote:
So if this markup were used in an HTML5 document:
Code:
<input type=foo>
And if this CSS was linked to that document:
Code:
input[type=foo] {
 background: lime;
}
Would the CSS be applied to that element?
Yes.
Back to top
View user's profile Send private message MSN Messenger
bfrohs
<h5>


Joined: 16 May 2007
Posts: 28
Location: Kalkaska, Michigan, United States

PostPosted: Wed May 16, 2007 8:37 pm    Post subject: Reply with quote

Xano wrote:
Makes sense to me, just like you say it.

On the other hand, what is exactly is the use of such a feature? The one browser that doesn't support new stuff within a reasonably short period after 'release' would be Internet Explorer and I wouldn't count on its developers implement this forward-compatibility feature.


I also doubt they would, but if it were a recommendation to do so, maybe it would encourage the IE developers to implement this forward-compatibility feature. Not only would it help with developing (X)HTML at a quicker pace (enabling the creation of tags more quickly without waiting for browsers to catch up), but it would also allow for currently unsupported tags to work with at least limited functionality.
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Sander Aarts
<h6>


Joined: 05 May 2007
Posts: 15
Location: +31(0)13

PostPosted: Thu May 17, 2007 2:54 am    Post subject: Reply with quote

This is a good thing I guess and I don't know why MS wouldn't want to build that into IE as it would make their browser more forward compatible as well.

If I understand this correctly then this feature also offers the possibility to create custom elements. Not elements that have a semantic value, but more <div>-/<span>-like. This can be great, but it can also be the path to invalid tag soup. If all kinds of applications that are incorporated in a website (internal site search, cms, etc.) use their own custom elements, it can become very messy again.
Is this something that has been considered or am I just a bit too pessimistic here? Wink
Back to top
View user's profile Send private message
zcorpan
<h1>


Joined: 06 Feb 2007
Posts: 444
Location: Sweden

PostPosted: Thu May 17, 2007 3:52 pm    Post subject: Reply with quote

Sander Aarts wrote:
If I understand this correctly then this feature also offers the possibility to create custom elements.
It already is possible, even in IE (if you use funny enough names, e.g. with colons in them), but it doesn't make it allowed to do so. Custom elements are forbidden to use in HTML5.
Back to top
View user's profile Send private message MSN Messenger
legendscrolls
<small>


Joined: 09 Jan 2008
Posts: 6

PostPosted: Sat Feb 09, 2008 4:29 pm    Post subject: Re: Unrecognised markup should be scriptable and stylable Reply with quote

Cerbera wrote:
Currently, the market leading browser (Internet Explorer) does not apply CSS to unrecognised elements. Also, its DOM is somewhat messed up for elements which are not recognised.


Actually IE does support styling unknown elements in HTML documents at least by, what I call, a DOM Trigger:
Say you want to use <section> and <article> in current IE 6 or higher you can write a little internal or external script in the head that has this code:
document.createElement("section");
document.createElement("article");

This will allow IE's CSS parser to style these elements even though IE doesn't currently, natively support them.
Although don't forget to at least style them with display: block.

Gecko, Presto and Webkit based such as Firefox, Opera and Safari all support styling without this DOM Trigger.

But KHTML based like Konqueror does not support styling unknown markup at all.
At least KHTML will be merging with Webkit so hopefully Konqueror 4.1 will.

iCab 4 appears to be built with Webkit so iCab now also supports styling unknown elements like Safari 3.
Back to top
View user's profile Send private message Visit poster's website
zcorpan
<h1>


Joined: 06 Feb 2007
Posts: 444
Location: Sweden

PostPosted: Sat Feb 09, 2008 8:29 pm    Post subject: Re: Unrecognised markup should be scriptable and stylable Reply with quote

legendscrolls wrote:

Actually IE does support styling unknown elements in HTML documents at least by, what I call, a DOM Trigger:
Say you want to use <section> and <article> in current IE 6 or higher you can write a little internal or external script in the head that has this code:
document.createElement("section");
document.createElement("article");

This will allow IE's CSS parser to style these elements even though IE doesn't currently, natively support them.
The CSS parser doesn't behave differently, but the HTML parser does. IE treats such tags pretty much the same as it would with tags that have colons in them -- the elements can have content, the case is preserved, stray end tags are ignored, and the /> syntax has the XML empty-element tag semantics. (Normally, IE creates empty elements for unknown start and end tags what's between the tags end up as siblings to those elements, the element names are uppercased, and the /> syntax is ignored.)

legendscrolls wrote:
Gecko, Presto and Webkit based such as Firefox, Opera and Safari all support styling without this DOM Trigger.
Gecko closes unknown elements at the first block-level element.
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    WHATWG HTML5 Forums Forum Index -> Feedback on the specs All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group