You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 10, 2020. It is now read-only.
AtomicComponent.init does not convey that it is for querying the whole document for a component and does not allow attaching a callback to an element.
Expected behavior
@sebworks suggested this structure by renaming the method for clarity and including an HTMLNode and callback function as a parameter:
AtomicComponent.instantiateAll = function( dom, callback ) {
var elements = ( dom || document ).querySelectorAll( this.selector );
var element;
var components = [];
for ( var i = 0; i < elements.length; ++i ) {
element = elements[i];
if ( element.hasAttribute( 'data-bound' ) === false ) {
var instance = new this( element );
components.push( instance );
callback ( index, instance)
}
}
return components;
};
The text was updated successfully, but these errors were encountered:
Current behavior
Expected behavior
The text was updated successfully, but these errors were encountered: