Skip to content

Commit

Permalink
fix: Allow direct descendant selector with scoped querySelector
Browse files Browse the repository at this point in the history
  • Loading branch information
guidobouman committed Apr 14, 2018
1 parent 570fe33 commit 9bcb296
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/panelSnap.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import {
getTargetScrollTop,
} from './utilities';

let INSTANCE_COUNTER = 0;

const defaultOptions = {
container: document.body,
panelSelector: '> section',
Expand All @@ -26,8 +28,12 @@ export default class PanelSnap {
};

this.container = this.options.container;

INSTANCE_COUNTER += 1;
this.instanceIndex = INSTANCE_COUNTER;

this.scrollingContainer = getScrollingElement(this.container);
this.panelList = this.container.querySelectorAll(this.options.panelSelector);
this.panelList = document.querySelectorAll(`[data-panelsnap-id="${this.instanceIndex}"] ${this.options.panelSelector}`);

this.isEnabled = true;
this.isMouseDown = false;
Expand Down

0 comments on commit 9bcb296

Please sign in to comment.