I believe this is the kind of general question that the Polymer team
prefers be on StackOverflow (for future reference), but I shall endeavor to
answer it.
In a nutshell: HTML attributes are case insensitive. I believe the specific
behavior differs a bit from browser to browser, but in Chrome at least if
you attempt to access an attribute (such as via node.attributes[0]) it will
automatically convert the attribute to downcase.
Since there can only be one of a given attribute value assigned to a node,
what's happening is simply that the Test attribute ceases to exist because
it is overridden by the (preferred) lowercase form. When you're declaring
the element, the first value assigned to the (case-insensitive) test
attribute is what seems to be captured, the other ignored.
Basically you can't count on reliable behavior if you double-define an
attribute, the same way that bad things happen if you declare two elements
with the same ID.
On Tuesday, August 5, 2014 12:42:53 AM UTC-7, Vishal Kumar Gupta wrote:
>
> Hi Team,
>
> I am bit confused about polymer element attributes and property.
> Can someone explain me why i am getting following output for the HTML
>
> *Output:-*
> Test = null, test = t1
> Test = null, test = t2
>
> *HTML:-*
> <!doctype>
> <html>
> <head>
> <script src="/components/platform/platform.js"></script>
> <link rel="import" href="/components/polymer/polymer.html">
> <link rel="import" href="/components/paper-item/paper-item.html">
>
> </head>
> <body fullbleed unresolved>
> <polymer-element name="test-element" attributes="Test test">
> <template>
> <paper-item label="Test = {{Test}}, test = {{test}}"></paper-item>
> </template>
> <script>
> Polymer("test-element", {});
> </script>
> </polymer-element>
> <test-element Test="t1" test="t2"></test-element>
> <test-element test="t2" Test="t1"></test-element>
>
> </body>
> </html>
>
> Regards,
> vishal
>
Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/polymer-dev/a51a8cd0-c2b4-4f0b-a94b-f58bdaa7b61f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.