-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
Injectable DOM properties #141
Conversation
action: null, | ||
ajaxify: DOMProperty.injection.MUST_USE_ATTRIBUTE, | ||
allowFullScreen: DOMProperty.injection.MUST_USE_ATTRIBUTE | | ||
DOMProperty.injection.HAS_BOOLEAN_VALUE, |
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.
Nit: can you store these as local variables at the top to make this code pretty again? :)
allowFullScreen: MustUseAttribute | HasBooleanValue,
* Mapping from normalized, camelcased property names to a configuration that | ||
* specifies how the associated DOM property should be accessed or rendered. | ||
*/ | ||
MUST_USE_ATTRIBUTE: 0x1, |
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.
Octal literals are deprecated in es5 but it looks like hex still works. I guess it doesn't actually matter but I would consider using parseInt
...
EDIT: realize now that this was already there, just shuffled
2 things that I think would need answers before we can merge:
|
I did this upstream. We decided to not expose the API publicly yet since we have a few unanswered questions. But at least now the core is injectable such that it's easy to build an API for this in the future. |
The upstream commit synced back down: 32423a8 |
Sorry to bump an old issue, but is there any chance this will be exposed? I'd like to use a jsx template like: <div dataCustomUri="{this.props.uri}"></div> And then use it for event delegation later: delegate(document, '[data-custom-uri]', function(e) { ... }); But right now react ignores all |
@kirbysayshi You should just be able to do |
You are correct! It looks like I had extra
vs
Sorry to bother. |
#140 was reported today which was something I was interested in fixing anyway. Turns out this is pretty easy.
During the course of this diff I noticed we didn't expose the id attribute; this is fixed. I use MUST_USE_PROPERTY per http://stackoverflow.com/questions/4851699/setting-the-id-attribute-of-an-input-element-dynamically-in-ie-alternative-for.
I think this internal refactoring is basically pure win. If you guys don't want to expose the API publicly yet to keep the surface area of the API small I can revert the second commit on this.
If accepted into the public API, I will document this. I think this is definitely a rough edge that people will run into. Also in the future we can reduce our byte size by making all the svg props optional.