Opened 7 years ago

Closed 4 years ago

#15079 closed defect (patchwelcome)

domConstruct.create on IE8 should not allow lowercase nodeName

Reported by: Nick Fenwick Owned by: Eugene Lazutkin
Priority: undecided Milestone: tbd
Component: HTML Version: 1.7.2
Keywords: Cc:
Blocked By: Blocking:

Description

Two issues to raise here, please advise if they should be separate tickets.

1/ domConstruct.create() can create DOM nodes, using its first argument to drive the creation. I've found that on Chrome and IE9 this always creates uppercase nodeName attribute values, but on IE8 it literally creates a nodeName using the string you give it. I first ran into this when creating nodes for the videojs project, they have a bugfix to work around the issue in https://github.com/zencoder/video-js/pull/154 but, more generally, dojo should have a block on this behaviour too.

2/ domConstruct.toDom() is incapable of creating DOM nodes for <video> elements, whereas <video> elements in markup are created without problem. This may or may not be something dojo can/should address. toDom uses innerHTML assignment to create the nodes, I'm not sure why it's failing.

See attached test case.

Output on IE9:

LOG: Iterating results... 
LOG: Iterating from node: markupdest 
LOG: nodeName: DIV 
LOG:  nodeName: VIDEO 
LOG:   nodeName: SOURCE 
LOG: Iterating from node: todomdest 
LOG: nodeName: DIV 
LOG:  nodeName: VIDEO 
LOG:   nodeName: SOURCE 
LOG: Iterating from node: createdest 
LOG: nodeName: DIV 
LOG:  nodeName: VIDEO 
LOG:   nodeName: SOURCE 

Output on IE8:

LOG: Iterating results...
LOG: Iterating from node: markupdest
LOG: nodeName: DIV
LOG:  nodeName: VIDEO
LOG:  nodeName: SOURCE
LOG:  nodeName: /VIDEO
LOG: Iterating from node: todomdest
LOG: nodeName: DIV
LOG: Iterating from node: createdest
LOG: nodeName: DIV
LOG:  nodeName: video
LOG:   nodeName: source

Expected behaviour:

1/ the <video> tag created by domConstruct.create in IE8 ought to have a nodeName value of 'VIDEO', not 'video'. This could be enforced by a toUpperCase() call in domConstruct.

2/ the <video> tag given to toDom() in IE8 should be created in the DOM.

Actual behaviour:

1/ domdest example completely fails to create nodes in IE8.

2/ createdest example creates lowercase nodeNames in IE8.

Attachments (1)

domConstruct-case-sensitivity.html (2.3 KB) - added by Nick Fenwick 7 years ago.
Test file using CDN that creates video nodes in three different ways.

Download all attachments as: .zip

Change History (4)

Changed 7 years ago by Nick Fenwick

Test file using CDN that creates video nodes in three different ways.

comment:1 Changed 7 years ago by bill

(2) is just a duplicate of #11808 but I guess (1) is valid.

comment:2 Changed 7 years ago by Nick Fenwick

Thanks Bill. I hadn't seen #11808. If that bug will 'fix' the toDom behaviour then fantastic. We'll then be able to use <video> etc. tags in _TemplatedMixin templates successfully, which currently fails in IE8 because it uses toDom(), which is how I ended up on the domConstruct.create() path.

(1) may be invalid if you mandate "you must write code like domConstruct.create('VIDEO')" but that doesn't seem good enough to me.. I feel the average developer is quite likely to write lowercase and the browsers don't seem to enforce the case sensitivity enough, see http://ejohn.org/blog/nodename-case-sensitivity/

Last edited 7 years ago by Nick Fenwick (previous) (diff)

comment:3 Changed 4 years ago by dylan

Resolution: patchwelcome
Status: newclosed

Given the lack of complaints after #11808, I'm going to close this as patch welcome. Feel free to submit a pull request to fix this, if the current state of things isn't sufficient.

Note: See TracTickets for help on using tickets.