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

bindAttr fails to render pathless class names in IE8 #1300

Merged
merged 1 commit into from
Aug 22, 2012
Merged

bindAttr fails to render pathless class names in IE8 #1300

merged 1 commit into from
Aug 22, 2012

Conversation

jdjkelly
Copy link
Contributor

Ember's bindAttr helper relies on the bindClasses function to create the 'class=""' string for the element it's being called on. bindClasses gets passed the space separated string that we use in our Handlebars templates (ex. {{bindAttr class="thing:foo :baz"}}. When parsing the classes, bindClasses calls _parsePropertyPath, which uses split() to figure out the pathname and classname for the property.

In the past, split was passed a string to match against:

path.split(':')

Today, we're using:

path.split(/:/)

The problem with the regex implementation is that it returns inconsistent results in different browsers. Take the following:

":foo".split(/:/)

In Chrome, Safari, Firefox, and IE9 we get:

["", "foo"]

In IE8, we get:

["foo"]

This causes all non-property classes (not sure what the terminology is, but I suppose you could call them 'literal' classes in the form ":foo") passed to bindAttr to fail to render in IE8. Given that passing a string to split returns the most consistent results across all browsers, this pull request includes a commit that changes the relevant _parsePropertyPath line to:

path.split(':')

…class names beginning with a colon to fail to render in IE8.
@travisbot
Copy link

This pull request passes (merged 98fde7b into 3f7a118).

wagenet added a commit that referenced this pull request Aug 22, 2012
bindAttr fails to render pathless class names in IE8
@wagenet wagenet merged commit 790fcd5 into emberjs:master Aug 22, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants