new Element('style', {text: ''}) throws IE exception #2265

Closed
ibolmo opened this Issue Jan 30, 2012 · 2 comments

Comments

Projects
None yet
2 participants
Owner

ibolmo commented Jan 30, 2012

Here's the fix: https://github.com/mootools/mootools-core/pull/2263/files#L1R21

(and btw, we need to update those lines once we're done)

IE doesn't like innerHTMl or innerText for stylesheet definitions. Instead we need to use styleSheet.cssText to set the text.

@ghost ghost assigned arian Feb 4, 2012

arian added a commit to arian/mootools-core that referenced this issue Feb 4, 2012

Fixes #2265 - Using .set('text', '…') on <style> elements failed in …
…oldIE

The feature detection tests actually tries to set the CSS, this is done
because IE9 does not fail, but supports the styleSheet property.
So this way IE9 behaves like other browsers.
Owner

arian commented Feb 4, 2012

I made this fix https://github.com/arian/mootools-core/compare/fix-2265-style-text

One issue still remains, using IE8:

var style = new Element('style', {type: 'text/css'});
console.log(style.styleSheet); // undefined

While using

var style = document.createElement('style');
style.type = 'text/css';
console.log(style.styleSheet); // object
Owner

ibolmo commented Feb 6, 2012

@arian any luck on this?

@ibolmo ibolmo modified the milestones: 1.5.1, 1.5 Mar 3, 2014

@ibolmo ibolmo closed this in #2622 Jul 4, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment