Last modified: 2009-08-09 20:14:19 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T22135, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 20135 - ID attributes for skin elements
ID attributes for skin elements
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
UsabilityInitiative (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Trevor Parscal
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-08-08 20:31 UTC by Cacycle
Modified: 2009-08-09 20:14 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Cacycle 2009-08-08 20:31:39 UTC
For the new vector skin as well as the new toolbar it would be of immense help to assign id attributes to  DOM elements that might be of any interest for user script or gadget authors. These would include all elements that already have class attributes. 

This would make time and code consuming complex DOM traversions and getElementByClass hacks obsolete and would render user scripts and gadgets more resistant to code changes in the skin.

(One specific example for which I currently have to hack a workaround is the new toolbar wrappers (wikiEditor-ui-xxx).)

Thanks in advance, Cacycle
Comment 1 Laurence 'GreenReaper' Parry 2009-08-08 20:39:09 UTC
Remember that every time you add an id to an element that "might be of interest", you add an extra few bytes for the user to download. That's not to say "don't use them" - ids can be very useful. Just try to keep them brief and within reason.
Comment 2 Chad H. 2009-08-08 20:46:41 UTC
Marking WONTFIX. Saying "add an ID to anything someone might find useful" is overly broad and generally a bad idea. If you've got specific elements that need them, feel free to file bugs for them and they can be judged on their own merit.
Comment 3 Cacycle 2009-08-08 22:44:34 UTC
Almost all relevant elements already have an id attribute! Adding the remaining ones would therefore not increase the page size noticeably. Also, this makes the request not "overly broad". (Just to make it clear, I am talking about skin/layout elements, not about the content)

The IDs should be added now, before the new vector skin is widely used on Mediawiki installations. Changing IDs at a later point when an author needs them would not make sense due to backward compatibility between unfixed skin installations and scripts.

And last, I have also asked to add IDs to specific elements (the new edit toolbar). Therefore I will reopen the bug.



Comment 4 Cacycle 2009-08-09 15:57:34 UTC
To be a bit more specific, I suggest to id-tag the following elements:

1. All parents of container elements
2. All elements with an existing class attribute (using the class name as the id attribute would not increase the transmitted page size by more than one or two bytes each due to zipping on all Wikimedia sites)
3. Important design elements that might be interesting for user scripts or gadgets and/or that might be otherwise difficult to address in a script (at the discretion of the skin developers), including the new toolbar containers.

Thanks in advance - Cacycle :-)
Comment 5 Roan Kattouw 2009-08-09 18:48:27 UTC
(In reply to comment #4)
> To be a bit more specific, I suggest to id-tag the following elements:
> 
> 1. All parents of container elements
I see no need for this. If the child element has an ID, getting its parent is easy.

> 2. All elements with an existing class attribute (using the class name as the
> id attribute would not increase the transmitted page size by more than one or
> two bytes each due to zipping on all Wikimedia sites)
> 3. Important design elements that might be interesting for user scripts or
> gadgets and/or that might be otherwise difficult to address in a script (at the
> discretion of the skin developers), including the new toolbar containers.
> 
New toolbar containers done in r54676, other elements may or may not be done when requested.
Comment 6 Cacycle 2009-08-09 20:14:19 UTC
Thanks for the toolbar ids :-) 

>> 1. All parents of container elements
> I see no need for this. If the child element has an ID, getting its parent is
easy.

I have actually suggested this for exactly the opposite direction: to be ably to select child elements without an ID, starting from their container. Therefore, this request still stands. Also, any DOM traversing is easily broken by future changes to the skin.

I will try to compile a list of elements and post them here. Requesting IDs when they are needed is not practicable as explained above. At a later stage, when vector is already in wide use, any generally applicable script would have to use a non-ID-based workaround for backward compatibility. 

Mediawiki is widely used on the internet as well as in (company) intranets and most other sides due not regularly update their skins as Wikipedia does. As most workarounds are time and code consuming and might be easily broken by routine changes in the skin, we have to anticipate and label important elements now.

Moreover, I do not see much reason not to add IDs generously, the effect on page size would be negligible, as explained above.  

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links