Skip to main content

Bug Tracker

Side navigation

#11715 closed bug (duplicate)

Opened May 07, 2012 01:20PM UTC

Closed May 07, 2012 02:53PM UTC

Last modified May 08, 2012 01:15PM UTC

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:

I was recently encountering the "problem" described here:

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:

Maybe this is desired behavior as well, yet I have to admit that I find it highly confusing.

Attachments (0)
Change History (4)

Changed May 07, 2012 02:53PM UTC by rwaldron comment:1

resolution: → duplicate
status: newclosed

Changed May 07, 2012 02:54PM UTC by rwaldron comment:2

Duplicate of #10125.

Changed May 08, 2012 09:35AM UTC by comment:3

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>


$('<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.

Changed May 08, 2012 01:15PM UTC by dmethvin comment:4

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.