This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 12948 - New feature request: GROUP tag What I'd like to achieve in HTML is to easily access a group of elements via Javascript using a single parent element (GROUP). The GROUP element would not under any circumstance affect the layout of the page, and would not b
Summary: New feature request: GROUP tag What I'd like to achieve in HTML is to easily ...
Status: RESOLVED WORKSFORME
Alias: None
Product: HTML WG
Classification: Unclassified
Component: LC1 HTML5 spec (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-13 22:56 UTC by contributor
Modified: 2011-08-04 05:04 UTC (History)
6 users (show)

See Also:


Attachments

Description contributor 2011-06-13 22:56:09 UTC
Specification: http://dev.w3.org/html5/spec/Overview.html
Section: http://www.whatwg.org/specs/web-apps/current-work/#top

Comment:
New feature request: GROUP tag

What I'd like to achieve in HTML is to easily access a group of elements via
Javascript using a single parent element (GROUP). The GROUP element would not
under any circumstance affect the layout of the page, and would not be able to
have style or CSS applied to it.

Why? For use in Widgets produced by a server side CMS the contents of the
Widgets could then be updated asynchronously, I'm sure there are other
applications.

Why not use a DIV? A DIV in it's normal form is a block level element that
affects the layout of the page, so we need to set "display:inline" to achieve
the desired result if it is the parent of other inline elements, and hope that
it doesn't get selected by any CSS selectors and have it's style influenced.

Thanks for any consideration this request may receive.

Andreas Baitis, abaitis@gmail.com

Posted from: 110.174.70.97
User agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110422 Ubuntu/10.10 (maverick) Firefox/3.6.17
Comment 1 Tab Atkins Jr. 2011-06-13 23:00:03 UTC
You can either use a <div> or <span> and just be careful not to style it, or set a class on all the elements you want and use document.getElementsByClassName() or document.querySelectorAll().
Comment 2 Andreas Baitis 2011-06-14 02:53:50 UTC
We are using DIVs now, one problem with this method is the content is arbitrary, sometimes containing only block elements, sometimes only inline, sometimes both. So this complicates things in that the CMS needs to decide on what sort of wrapper to use, block or inline. Also the group or wrapper elements can be accessed by designers through CSS which is not desirable, we want them to style the content based on the semantics of the content, not the CMS.

Adding classes and using document.getElementsByClassName() or similar works but is not without issues, it adds to the file size when pages are complex with multiple widgets being used, and makes replacing the nodes with the updated content a little messier, although it's probably the way we'll go as these issues are easier to deal with than the issues mentioned above.

Many web-sites are now data driven, and constructed by ever more sophisticated CMS, it'd be nice to help CMS developers create clean standards based semantic markup, so I would've thought that it's worth considering.



Thanks for your time anyway.

Regards

Andreas Baitis
Comment 3 Aryeh Gregor 2011-06-14 22:50:05 UTC
We can't have an element that's in the DOM but has no style.  That would require significant changes to all sorts of things, which just aren't worth it.

Would I be crazy to suggest that <span> just be allowed to contain block elements?  It has the correct visual behavior, right?  Why is it invalid as a block wrapper to start with?
Comment 4 Tab Atkins Jr. 2011-06-15 00:11:36 UTC
(In reply to comment #3)
> Would I be crazy to suggest that <span> just be allowed to contain block
> elements?  It has the correct visual behavior, right?  Why is it invalid as a
> block wrapper to start with?

Its default display value interacts badly with block descendants, for one.
Comment 5 Aryeh Gregor 2011-06-15 22:32:28 UTC
How so?
Comment 6 Tab Atkins Jr. 2011-06-15 23:41:17 UTC
Inlines that contain blocks are split around the blocks into multiple inline boxes.
Comment 7 Aryeh Gregor 2011-06-16 18:14:12 UTC
And this differs how from the desired behavior here?  In what case would $foo and <span>$foo</span> render differently, assuming that $foo is a snippet of HTML markup in the body with all tags properly closed?  (You do have to make sure to properly close tags, because </span> doesn't auto-close <p> and such.)
Comment 8 Tab Atkins Jr. 2011-06-16 21:12:05 UTC
If you had any styles defined for "span", like borders, you'd get some unexpected rendering.
Comment 9 Aryeh Gregor 2011-06-16 22:14:36 UTC
The use case according to comment 0 is that there are no styles defined.
Comment 10 Andreas Baitis 2011-06-16 22:48:27 UTC
(In reply to comment #9)
> The use case according to comment 0 is that there are no styles defined.

The use case is that sometimes designers will style the SPAN or DIV because they can, hence the request for the GROUP tag which can not be styled, it's sole purpose would be to group it's children.
Comment 11 Aryeh Gregor 2011-06-17 17:13:40 UTC
That is not going to happen.  All elements are styleable, no way are we going to change that without *extremely* good reason.
Comment 12 Andreas Baitis 2011-06-18 05:45:25 UTC
(In reply to comment #11)
> That is not going to happen.  All elements are styleable, no way are we going
> to change that without *extremely* good reason.

OK thanks for everyones time anyway, I had to ask of course :)
Comment 13 Aryeh Gregor 2011-06-19 22:15:36 UTC
If you would like to withdraw the request, please mark the bug RESOLVED INVALID.  That way the editor won't have to spend his time reading it, and can read other people's bugs instead.
Comment 14 Andreas Baitis 2011-06-20 00:39:14 UTC
(In reply to comment #13)
> If you would like to withdraw the request, please mark the bug RESOLVED
> INVALID.  That way the editor won't have to spend his time reading it, and can
> read other people's bugs instead.
Comment 15 Michael[tm] Smith 2011-08-04 05:04:25 UTC
mass-moved component to LC1