Skip to content

Commit

Permalink
add getDocument to offcanvas.js & use it on base-component
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoSot committed Mar 11, 2021
1 parent 9779869 commit a303127
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion js/src/base-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const VERSION = '5.0.0-beta2'

class BaseComponent {
constructor(element) {
element = typeof element === 'string' ? document.querySelector(element) : element
element = typeof element === 'string' ? getDocument().querySelector(element) : element

if (!element) {
return
Expand Down
3 changes: 2 additions & 1 deletion js/src/offcanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import {
defineJQueryPlugin,
getDocument,
getElementFromSelector,
getSelectorFromElement,
getTransitionDurationFromElement,
Expand Down Expand Up @@ -200,7 +201,7 @@ class OffCanvas extends BaseComponent {
* ------------------------------------------------------------------------
*/

EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
EventHandler.on(getDocument(), EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
const target = getElementFromSelector(this)

if (['A', 'AREA'].includes(this.tagName)) {
Expand Down

0 comments on commit a303127

Please sign in to comment.