-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Expose DOM Helpers #2754
Expose DOM Helpers #2754
Conversation
3d040ea
to
292390a
Compare
@@ -44,6 +44,8 @@ let trackToJson_ = function(track) { | |||
* @function textTracksToJson | |||
*/ | |||
let textTracksToJson = function(tech) { | |||
|
|||
// Cannot use $$ here because it is not an instance of Tech | |||
let trackEls = tech.el().querySelectorAll('track'); |
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.
isn't tech
here a Tech and thus it should have $$
?
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.
It wasn't when I was working on this PR (hence the comment).
I think it makes sense to use more powerful native APIs when they are available. In this case, we use `classList` for all browsers but IE8 and IE9. Also, adds slightly more rigorous tests for these functions.
- Also adds comprehensive tests. - Exposes the function as `toggleClass` on `videojs`. - Adds the `toggleClass` method to components.
862ed69
to
a697a2c
Compare
LGTM. Going to make another PR after this to fix the tracks JSON that I commented about above. |
Building on the
ModalDialog
work...$
and$$
(essentially,querySelector
andquerySelectorAll
respectively).toggleElClass
function.videojs
function.className
manipulation functions to useclassList
if it's available (which is true of all supported browsers except IE8).Note: The methods are generally exposed without the
El
part (i.e.Dom.hasElClass
is exposed asvideojs.hasClass
). The reason for this is parity with popular JS libraries (jQuery, etc) that people are familiar with.