Expose DOM Helpers #2754
@@ -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'); |
It wasn't when I was working on this PR (hence the comment).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
|
+ * Finds a single DOM element matching `selector` within the optional | ||
+ * `context` of another DOM element (defaulting to `document`). | ||
+ * | ||
+ * @method $ | ||
+ * @param {String} selector | ||
+ * A valid CSS selector, which will be passed to `querySelector`. | ||
+ * | ||
+ * @param {Element|String} [context=document] | ||
+ * A DOM element within which to query. Can also be a selector | ||
+ * string in which case the first matching element will be used | ||
+ * as context. If missing (or no element matches selector), falls | ||
+ * back to `document`. | ||
+ * | ||
+ * @return {Element|null} | ||
+ */ | ||
+videojs.$ = Dom.$; |
I'm worried that exposing That's fair and makes a ton of sense. To be clear: do you want to keep them internally and on components or ditch them entirely? I'm fine with either - they are the least useful part of this PR, I think. Keeping them internal is fine, since doing And keeping them on Yeah, I guess them leaking that way isn't completely terrible because it'll mostly be used for vjs-related things and not just people using
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
|
misteroneill |
f2fa8f8
|
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.