https://bugzilla.wikimedia.org/show_bug.cgi?id=30471

Krinkle <krinklem...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WORKSFORME                  |
            Summary|MediaWiki generates ids     |MediaWiki should not
                   |which can't be selected     |generate ids that are hard
                   |                            |to select

--- Comment #2 from Krinkle <krinklem...@gmail.com> 2012-08-29 13:04:45 UTC ---
(In reply to comment #1)
> You can escape dots in ID selectors. In CSS:
> #mediaWiki\.loader { color: red; }
> 
> in jQuery:
> $( '#mediaWiki\\.loader );  // double \ needed to produce one \ in the string

I agree it is indeed not impossible. But looking at the wider picture:
MediaWIki sanitizes the textual content of the heading and creates an ID that
doesn't contain illegal characters. But since it is somewhat sanitized already
(just like we do for class names, though we do a better job there) I think it
is perfectly reasonable to make this sanitize dots and other charaters as well.

It doesn't have to be impossible, but making it convenient and optimized for
usage in CSS is just as important. Since the only reason we output them is for
usage in CSS (and by JavaScript, and for anchor-jumping), it makes perfect
sense to optimize for that usage and not require escaping in 2/3 use cases.

[[Sandbox.js]]
> Sanitizer::escapeClass( 'page-' . $title->getPrefixedText() )
> <body class=" .... page-Sandbox_js ..">

Looks nice.

== Sandbox.js {foo[test]} ==

> .. class="mw-headline" id="Sandbox.js_.7Bfoo.5Btest.5D.7D"> Sandbox.js 
> {foo[test]} ..

That's pretty horrible and not justifiable in my opinion.


> .. class="mw-headline" id="Sandbox_js_foo_test_"> Sandbox.js {foo[test]} ..

The above would be much better (stripping unwanted characters, non-repeating,
uniqueness would be enforced with incrementing numbers appended, like we do
already for similar headings).

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to