-
Notifications
You must be signed in to change notification settings - Fork 190
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
Create sanitized attribute and property classes #197
Conversation
let { element } = this; | ||
let { tagName } = element; | ||
|
||
if (SanitizedProperty.requiresSanitization(tagName, name)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this use the method off of SanitizedNonNamespacedAttribute instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is the result of copy pasta. Will fix.
} else if (tagName === 'INPUT' && name === 'value') { | ||
this.group.push(new EmptyStringResetingProperty(element, name, reference)); | ||
} else { | ||
this.group.push(new NonNamespacedAttribute(element, name, reference)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the conditions here. This used to push two objects in the case of input[value]
. Was this the correct behavior? For the sanitized case it should be one or the other, not both. @asakusuma
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, I would have thought the tests would fail if you did this but apparently not. I had assumed you needed both. I added a specific test case around this though, so I'm not too worried about this change breaking things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
This was superseded |
This creates "sanitized" subclasses of
Property
andNonNamespacedAttribute
which enforce sanitization of known dangerous tag/attribute combinations. This also makes https://github.com/emberjs/ember.js/blob/1be0354068d933065ac542f49d42d73409366a47/packages/ember-glimmer/tests/integration/components/attribute-bindings-test.js#L456 and https://github.com/emberjs/ember.js/blob/3cfc9614bbd92ee8e80b6c4894b024f2e14bffae/packages/ember-glimmer/tests/integration/helpers/unbound-test.js#L98 pass.