Thanks Thomas. Read and understood. Would it not be helpful to put that in the comments block of getTagName() just to make it very clear to the users who haven't come across that section in the HTML spec?
On Jun 23, 1:16 pm, Thomas Broyer <[email protected]> wrote: > On 23 juin, 11:05, Paul Schwarz <[email protected]> wrote: > > > > > > > Using 2.1 M1 I noticed that Element has the method hasTagName, which > > looks like this: > > > public final boolean hasTagName(String tagName) { > > assert tagName != null : "tagName must not be null"; > > return tagName.equals(getTagName()); > > } > > > Almost synonymous with this: > > "div".equals(element.getTagName()) > > > However one gotcha got me, assume element is a "div": > > "div".equals(element.getTagName()) ---> returns false :-( > > "DIV".equals(element.getTagName()) ---> returns true :-) > > > Likewise: > > element.hasTagName("div") ---> returns false :-( > > element.hasTagName("DIV") ---> returns true :-) > > > Obviously Java's String .equals() method is case sensitive. But how > > would we know that element.getTagName returns uppercase or otherwise? > > Because that's what the DOM says (and what browsers > do):http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-822762427http://www.w3.org/TR/html5/embedded-content-0.html#apis-in-html-docum... > > When Firefox 4 will ship with HTML5's support for inlined SVG and > MathML, SVG and MathML elements will however be returned in lower-case > (or camel case for e.g. foreignObject), because they're not in the > "HTML namespace". -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
