Known limitations: doesn’t catch onwebkitsomething changes, because I don’t know how to detect their presence.
Plugin for JS APIs. Adds ability to use them without prefixes too
Why not simply self.Prefix.toLowerCase()? The rest is lowercased anyway, so no reason for splitting.
Could it be “WebKit” or something? Are you 100% sure it can’t?
Yes. Look at the way it’s generated.
Wouldn’t it be better to check in a case-insensitive manner? Like, have a cached regex var prefixRegex = RegExp(prefix, 'i') and use name.search(prefixRegex)? Some DOM properties use proper camelcasing, i.e. start with an uppercase letter.
var prefixRegex = RegExp(prefix, 'i')
An entire copyright notice about Adobe and no mention of your name as the author of this code? I’m not sure of the legal obligations you have as an Adobe employee, but it doesn't seem reasonable that you can't at least include your name.
I could add one line comment re my name, but because I was working on this in my company’s time I have to include this notice.
Yeah, the notice is fine, but please include your name too.
Don’t we have to take care of camelcasing too? In my tests (for transitionend) capitalization seemed to matter (i.e. the event didn't fire if the capitalization wasn’t right). Also, are we sure there's no case where both prefixed and unprefixed versions are supported? That would be catastrophic.
I don’t think it is possible to detect. if user write transitionend then I maximum script can do is to prepend it with prefix.
Events are tricky, if you insist we can drop it altogether unless there is a method to determine which prefixed events are supported ATM.
I mean, instead of just prefix + name, to also uppercase the first character of name.
prefix + name
Sorry, was away at the conference. There is a problem: webkitTransitionend and webkitTransitionEnd are different, but there is no way I could construct webkitTransitionEnd from webkit and transitionend, unless I carry on a vocabulary.
The question is: what is better partial support or no support?
It would be nice if the code was a bit better commented. I.e. I have no idea what this function does before reading the source.
Edit: Or even after reading it.
It digs through the objects in order to find out which have prefixed methods and therefore, which need to be extended.
Ok, that would be nice as a comment :P
Thank you very much for the contribution. This is great work, something like this was really needed! I added some comments in the source, could you please reply there?
added comments, use regexp for searching
Here are all the changes except for the events. Not sure how to tame them.
In any case, this is an additional plugin, so I'm merging this, as people might need it. Then, you can send future pull requests for the other issues.
You should also add a reference to the plugin in the project's page.