@Acutally, no. The only bug is with the W3C web standards. Or at least a very annoying 'feature'.
We talk here about a JavaScript library which should make working with JavaScript and browsers easier. The basic getElementByID() gets ":", jQuery gets ":" in ID {name}. YUI fails. This I call a bug because it does not work as expected.
From the JavaScript point of view it can't play a role how a library finds elements. I just expect no differences between basic JavaScript and a library.
Differences lead to unnecessary frustrating experiences as we see.
Urs Hunkler
Beiträge von Urs Hunkler
YUI has a bug here.
Have a look at http://jsbin.com/ayesay/8/edit#source to see that an ID without ":_" works in YUI.
jQuery works - another reason to switch to jQuery I think.
Have a look at http://jsbin.com/ayesay/8/edit#source to see that an ID without ":_" works in YUI.
jQuery works - another reason to switch to jQuery I think.
Joseph,
your element id is not valid XHTML and therefore YUI refuses to find it I suppose.
Valid characters for IDs and CLASSes:
The id attribute value must begin with a letter in the roman alphabet (a–z or A–Z); this can be followed by any combination of letters (a–z or A–Z), digits (0–9), hyphens "-", underscores "_", colons ":", and periods ".". (From http://reference.sitepoint.com/html/core-attributes/id)
you may change your ID and the ID finding will work in YUI.
By the way it's strange that document.getElementById finds the element - may be because the browser is prepared for HTML5 where more characters are allowed.
Edit: I reread the list of allowed characters more carefully and noticed that the colon is allowed - I didn't know that. So your ID should be valid and YUI must find the element. Otherwise it's a YUI bug.
Have you tried using different names for name and id?
your element id is not valid XHTML and therefore YUI refuses to find it I suppose.
Valid characters for IDs and CLASSes:
The id attribute value must begin with a letter in the roman alphabet (a–z or A–Z); this can be followed by any combination of letters (a–z or A–Z), digits (0–9), hyphens "-", underscores "_", colons ":", and periods ".". (From http://reference.sitepoint.com/html/core-attributes/id)
you may change your ID and the ID finding will work in YUI.
By the way it's strange that document.getElementById finds the element - may be because the browser is prepared for HTML5 where more characters are allowed.
Edit: I reread the list of allowed characters more carefully and noticed that the colon is allowed - I didn't know that. So your ID should be valid and YUI must find the element. Otherwise it's a YUI bug.
Have you tried using different names for name and id?
In a somehow related issue "All admin pages should use the 'admin' page layout." (MDL-28124) David and I came to the conclusion that a consistent use of "admin" pages in Moodle would help in many places.
For example with the opportunity to build an "Admin theme" handling all admin pages consistent and usable. When this theme may be well done theme designers could use the admin theme for all admin pages and focus on the individual design for the user visible pages.
If you like the idea please vote on the issue. Nobody voted so far.
For example with the opportunity to build an "Admin theme" handling all admin pages consistent and usable. When this theme may be well done theme designers could use the admin theme for all admin pages and focus on the individual design for the user visible pages.
If you like the idea please vote on the issue. Nobody voted so far.