#11715 closed bug (duplicate)
Passing attributes on object creation is inconsistent / depends on casing
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.7.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I was recently encountering the "problem" described here: http://bugs.jquery.com/ticket/10125
Yet I found out that when you use 'Width'
and 'Height'
(upper-casing the first letter) the passed pairs will be interpreted as attributes, not as CSS.
See this demo jsfiddle: http://jsfiddle.net/Lfh9F/
Maybe this is desired behavior as well, yet I have to admit that I find it highly confusing.
Change History (4)
comment:1 Changed 11 years ago by
Resolution: | → duplicate |
---|---|
Status: | new → closed |
comment:2 Changed 11 years ago by
comment:3 Changed 11 years ago by
Actually I don't think this is a duplicate. What I was talking about is that:
$('<canvas/>',{'id':'a', 'width':100, 'height':100})
will create
<canvas id="a" style="width: 100px; height: 100px;"></canvas>
whereas
$('<canvas/>',{'id':'b', 'Width':100, 'Height':100})
will create
<canvas id="b" width="100" height="100"></canvas>
In case this is desired behavior it might be interesting to mention this in the api-docs. Thanks.
comment:4 Changed 11 years ago by
There are so many ways to do things wrong, we tend to only mention the really common ones. Besides it's totally up to the document how to interpret mixed-case attributes. HTML DOM always ignores case. XML and XML-based documents do not. The developer needs to know some of this, it can't fall totally in the hands of jQuery to train people about every aspect of development.
Duplicate of #10125.