JamesMGreene / qunit-assert-html

A QUnit plugin for assertion methods to compare two HTML strings for equality after a rigorous normalization process.
MIT License
13 stars 5 forks source link

Normalize CSS colors for IE6-8 #2

Open JamesMGreene opened 11 years ago

JamesMGreene commented 11 years ago

TL;DR: This addon currently does not normalize certain CSS style properties (e.g. color values) in IE < 9.

IE9+ and other browsers normalize the value the user sets. IE8- leaves the value as exactly what the user specified, even if error correction behavior handles it differently. For a little more info, see jquery/qunit#368.

Implementation notes for fixing:

JamesMGreene commented 10 years ago

e.g. for { "color": "red" }

"red" === "#FF0000" === "#F00" === "#FF0000FF" === "rgb(255, 0, 0)"

JamesMGreene commented 10 years ago

More Notes:

JamesMGreene commented 10 years ago

Suggestion: I am thinking any work on this should be implemented as an optional "module" that can be optionally included (namely just for IE<9, I guess), e.g.

QUnit.assert.html.color = function normalizeColor(val, prop, el) {
  /* Normalize color values here */
  /* `el` and `prop` would be needed to support `currentcolor`, otherwise they are unnecessary */
};