Last modified: 2011-12-14 17:37:27 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 T31049, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 29049 - Check generated html for duplicate id= attributes.
Check generated html for duplicate id= attributes.
Status: RESOLVED DUPLICATE of bug 7356
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
unspecified
All All
: Normal enhancement with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
: newparser
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-05-19 10:51 UTC by Purodha Blissenbach
Modified: 2011-12-14 17:37 UTC (History)
2 users (show)

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


Attachments

Description Purodha Blissenbach 2011-05-19 10:51:28 UTC
Currently, it is perfectly possible to use html id= attributes inside
a wiki page giving them arbitrary values. When using one that is
also used by the skin, or duplicating id= values inside the page text,
one can generate invalid html, since id= values have to be unique within
html documents.

While this error class is tolerated by browsers and thus does not
usually cause problems to users, intended use of id= values for
either styling via CSS or as fragment identifiers that browsers
are expected to scroll to, is impacted.

At the moment, editors are not notified of the possibility of
problems, and duplicated id= values are not diagnosed.

Since it is obvious that the parser could collect id= values
for finding duplicates, this should be considered for the new
parser. Checking the id= values is one of the tasks requiring
a full page parse even during section editing, otherwise
sufficient data needs to be kept with each page to know existing
id= values of other sections without parsing them.

I would also suggest to reserve a series of id= values for
the use by MediaWiki and document that so as to reduce the
likelyhood of conflicts. Since using id= attributes is a
subject matter likely outside the scope of casual, unexperienced
and less educated editors, I also suggest to just accept duplicates
during a 2nd save, such as empty "Summary" fields. Maybe even
a toggle in Special:Preferences similar to the one for the
handling of empty "Summary" fields can be considered for the
id= value checking.

This bug is related to bug 7356.
Comment 1 Chad H. 2011-05-21 04:14:19 UTC
(In reply to comment #0)
> I would also suggest to reserve a series of id= values for
> the use by MediaWiki and document that so as to reduce the
> likelyhood of conflicts.
>

Generally speaking, classes and IDs added nowadays to the interface are prefixed by "mw-" to help avoid collisions with user input. In fact, this is documented at [0]. If the rest of your proposal were implemented (issuing warnings for duplicate IDs), we could throw a general warning for any ID beginning with "mw-".

[0] http://www.mediawiki.org/wiki/Coding_convention#Messages - beginning with 'HTML class and ID names should be prefixed with "mw-"...'
Comment 2 Brion Vibber 2011-06-02 20:02:08 UTC
This seems to be the same issue as bug 7356; marking as a dupe. Is there any additional information that's not already listed there?

*** This bug has been marked as a duplicate of bug 7356 ***

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


Navigation
Links