Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix setter so IE7/8 can set text of style element #2622

Merged
merged 2 commits into from
Jul 4, 2014

Conversation

SergioCrisostomo
Copy link
Member

fixes #2265

Our setters brake old IE when setting text of a style element.
This pull request adds a alternative propertySetters.text in case the problem exists in the Browser.

Used some ideas from @arian's fix on his fix-2265-text branch.

Document.implement({

newElement: function(tag, props){
if (props && props.checked != null) props.defaultChecked = props.checked;

/*<ltIE9>*/ // IE needs the type to be set before changing content of style element
if (!canChangeStyleHtml && ~tag.indexOf('style')){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not tag == 'style'?

@ibolmo ibolmo added this to the 1.5.1 milestone Jul 3, 2014
Setter and Getter for "style" element is special in old IE. This creates
exceptions to take care of that.
@SergioCrisostomo
Copy link
Member Author

@ibolmo updated!

if (!canChangeStyleHTML && tag == 'style'){
var styleElement = document.createElement('style');
styleElement.setAttribute('type', 'text/css');
props.type && delete props.type;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit picking, but

if (props.type) delete props.type; 
ibolmo added a commit that referenced this pull request Jul 4, 2014
Fix setter so IE7/8 can set text of style element
@ibolmo ibolmo merged commit d1dce0f into mootools:master Jul 4, 2014
@SergioCrisostomo SergioCrisostomo deleted the fix-2265-ieStyleText branch July 4, 2014 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants