mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-08 06:36:33 +02:00
Allow constructors to accept a CSS selector (#32245)
Co-authored-by: XhmikosR <xhmikosr@gmail.com> Co-authored-by: Mark Otto <otto@github.com>
This commit is contained in:
@@ -17,12 +17,14 @@ const VERSION = '5.0.0-beta2'
|
||||
|
||||
class BaseComponent {
|
||||
constructor(element) {
|
||||
element = typeof element === 'string' ? document.querySelector(element) : element
|
||||
|
||||
if (!element) {
|
||||
return
|
||||
}
|
||||
|
||||
this._element = element
|
||||
Data.setData(element, this.constructor.DATA_KEY, this)
|
||||
Data.setData(this._element, this.constructor.DATA_KEY, this)
|
||||
}
|
||||
|
||||
dispose() {
|
||||
|
Reference in New Issue
Block a user