Created
May 10, 2017 18:21
-
-
Save tcuongtran/1eea8890726bdd9070479103a0395d2b to your computer and use it in GitHub Desktop.
IE9: D3 throw exception on setProperty
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers | |
var d3_style_prototype = this.CSSStyleDeclaration.prototype, | |
d3_style_setProperty = d3_style_prototype.setProperty; | |
d3_style_prototype.setProperty = function (name, value, priority) { | |
try { | |
d3_style_setProperty.call(this, name, value + '', priority); | |
} catch (exception) { | |
// console.warn('d3_style_prototype.setProperty - name: ', name, ', value: ', value, ', priority: ', priority, ', exception: ', exception); | |
switch (name) { | |
case 'left': | |
name = 'start'; | |
break; | |
case 'right': | |
name = 'end'; | |
break; | |
default: | |
name = 'middle'; | |
break; | |
} | |
d3_style_setProperty.call(this, name, value + '', priority); | |
} | |
}; | |
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment