blixhavn/sticky-sidebar-v2

Line 84 can throw unhandled TypeError

ArsBarsj opened this issue · 0 comments

document.querySelector returns null if it didn't find element. Line 84 can throw unhandled TypeError

constructor(sidebar, options = {}){
this.options = StickySidebar.extend(DEFAULTS, options);
// Sidebar element query if there's no one, throw error.
this.sidebar = ('string' === typeof sidebar ) ? document.querySelector(sidebar) : sidebar;
if( 'undefined' === typeof this.sidebar )
throw new Error("There is no specific sidebar element.");
this.sidebarInner = false;
this.container = this.sidebar.parentElement;