Skip to content
This repository
Browse code

Fix dijit/_editor/html on IE9 to use W3C code path to get node attrib…

…ute .

Had to move some has() tests from parser.js to has.js, so they could be shared by this module.

Also making IE8 (in standards mode) follow W3C code path as much as possible, to be able to remove IE6-7 code branch for 2.0.

Fixes image tag width/height corruption on IE9.

Fixes #15032 !strict.
  • Loading branch information...
commit 162e1168a8ea75e3649db6a1ebd2be6ab9be4c73 1 parent 8cc4fed
Bill Keese wkeese authored

Showing 2 changed files with 8 additions and 12 deletions. Show diff stats Hide diff stats

  1. +8 0 has.js
  2. +0 12 parser.js
8 has.js
@@ -109,6 +109,14 @@ define(["require"], function(require) {
109 109 has.add("touch", "ontouchstart" in document);
110 110 // I don't know if any of these tests are really correct, just a rough guess
111 111 has.add("device-width", screen.availWidth || innerWidth);
  112 +
  113 + // Tests for DOMNode.attributes[] behavior
  114 + // dom-attributes-explicit - attributes[] only lists explicitly user specified attributes
  115 + // dom-attributes-specified-flag (IE8) - need to check attr.specified flag to skip attributes user didn't specify
  116 + // Otherwise, it's IE6-7. attributes[] will list hundreds of values, so need to do outerHTML to get attrs instead.
  117 + var form = document.createElement("form");
  118 + has.add("dom-attributes-explicit", form.attributes.length == 0); // W3C
  119 + has.add("dom-attributes-specified-flag", form.attributes.length < 40); // IE8
112 120 }
113 121
114 122 has.clearElement = /*===== dojo.has.clearElement= ======*/ function(element) {
12 parser.js
@@ -10,18 +10,6 @@ define(
10 10
11 11 new Date("X"); // workaround for #11279, new Date("") == NaN
12 12
13   -if (has("dom")) {
14   - var form = document.createElement("form");
15   - // Test if DOMNode.attributes only lists the attributes the user specified, not attributes w/default values.
16   - has.add("dom-attributes-explicit", form.attributes.length == 0);
17   -
18   - // IE8 will erroneously list a few attributes that weren't specified,
19   - // but we know to skip them because they have a specified flag which is false
20   - has.add("dom-attributes-specified-flag", form.attributes.length < 40);
21   -
22   - // Otherwise, it's IE6-7. form.attributes will list hundreds of values, so need to do outerHTML instead.
23   -}
24   -
25 13 dojo.parser = new function(){
26 14 // summary:
27 15 // The Dom/Widget parsing package

0 comments on commit 162e116

Please sign in to comment.
Something went wrong with that request. Please try again.