Removing jQuery from Alert#23596
Conversation
448b4a9 to
2a5a34d
Compare
8e1d401 to
96e025c
Compare
|
It seems on Windows 8 and 8.1 for IE10 and IE11 |
2c0c0d4 to
28b8564
Compare
There was a problem hiding this comment.
Perhaps we should have a find method for querySelector? It should be faster than querySelectorAll especially if we know we want one element.
There was a problem hiding this comment.
BTW, what do you think about adding helper methods around qsa, qs, etc? Instead of us calling the whole thing across the codebase this should result in shorter minified code.
There was a problem hiding this comment.
Maybe a findOne method should be a good thing with querySelector and why not adding helpers methods but I prefer longer method because it's simple to know what they do
There was a problem hiding this comment.
Do you have any ideas why it failed on IE ? I added a CustomEvent polyfill
There was a problem hiding this comment.
I still think we should have our helpers around qsa, qs, etc. The minified code will be a lot shorter that way. We can still name them Util.getElementById etc.
There was a problem hiding this comment.
You should make a PR when this one will be merged 👍
There was a problem hiding this comment.
Found on my local IE thanks 👍 btw I hate to debug on IE 😢
There was a problem hiding this comment.
@Johann-S: maybe we could make find accept an element parameter and if missing use document?
Regarding findOne since we already have a function I think it might be better if we just filter the selector and if it's one then call querySelector. For all this we should do some benchmarks because I'm not sure if it's worth in this case. If we called it directly it should be faster for sure.
There was a problem hiding this comment.
Yes I agree for your two proposals 👍
28b8564 to
9b65b23
Compare
|
I win against IE 💪 😆 |
|
IE keeps bugging us :/ Glad you solved it I'll try to have a look tomorrow.
BTW perhaps we should have more tests now for these cases.
…On Aug 21, 2017 23:23, "Johann-S" ***@***.***> wrote:
I win against IE 💪 😆
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#23596 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAVVtTDOIXS1de_d6egv0Hl3AqnnDe8hks5saedMgaJpZM4O9UXM>
.
|
| return null | ||
| } | ||
|
|
||
| let selectorType = 'querySelectorAll' |
There was a problem hiding this comment.
After looking into this file I still believe we should have a wrapper generic function and instead do what I suggested and just provide qsa, qs, etc. It's one less thing for the engine to do so it should be as fast possible.
There was a problem hiding this comment.
I'm not against it but that's not something to prioritize here we should focus on event namespacing
| var $alert = $('<div class="alert"/>') | ||
| $alert.appendTo('#qunit-fixture') | ||
|
|
||
| EventHandler.on($alert[0], 'close.bs.alert', function (e) { |
There was a problem hiding this comment.
So, things still work fine with jQuery?
| "js-lint-docs": "eslint --config js/tests/.eslintrc.json assets/js/", | ||
| "js-compile": "npm-run-all --parallel js-compile-*", | ||
| "js-compile-bundle": "shx cat js/src/dom/event.js js/src/util.js js/src/alert.js js/src/button.js js/src/carousel.js js/src/collapse.js js/src/dropdown.js js/src/modal.js js/src/scrollspy.js js/src/tab.js js/src/tooltip.js js/src/popover.js | shx sed \"s/^(import|export).*//\" | babel --filename js/src/bootstrap.js | node build/stamp.js > dist/js/bootstrap.js", | ||
| "js-compile-bundle": "shx cat js/src/dom/eventHandler.js js/src/dom/selectorEngine.js js/src/dom/data.js js/src/util.js js/src/alert.js js/src/button.js js/src/carousel.js js/src/collapse.js js/src/dropdown.js js/src/modal.js js/src/scrollspy.js js/src/tab.js js/src/tooltip.js js/src/popover.js | shx sed \"s/^(import|export).*//\" | babel --filename js/src/bootstrap.js | node build/stamp.js > dist/js/bootstrap.js", |
There was a problem hiding this comment.
Just thinking out loud: this is getting too big. Would it be possible to move this outside of package.json maybe to an external json file file or something?
There was a problem hiding this comment.
Yes that would be better if we have other file to add
There was a problem hiding this comment.
Yes, but this is just planning ahead. We'll definitely need it and this just seems like bad planning to me.
There was a problem hiding this comment.
With my PR which improve our modularisation I introduced a bundler (Rollup) which handle that pretty well
b353ca1 to
e9b95e9
Compare
e9b95e9 to
438f06b
Compare
87dd8dd to
b91d0c8
Compare
|
|
||
| if (selector) { | ||
| parent = $(selector)[0] | ||
| const tmpSelected = SelectorEngine.find(selector) |
There was a problem hiding this comment.
Do we really need this temp var?
There was a problem hiding this comment.
No we can remove this var 👍
| // static | ||
|
|
||
| static _jQueryInterface(config) { | ||
| return this.each(function () { |
There was a problem hiding this comment.
I wonder how this still works. each is jQuery specific, isn't it?
There was a problem hiding this comment.
Yes but this method is called only when jQuery is present
|
Yup I just saw after I made the comment:) I'm just getting a TypeError in
button but we'll see when time comes.
…On Aug 23, 2017 15:51, "Johann-S" ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In js/src/alert.js
<#23596 (comment)>:
> Util.emulateTransitionEnd(element, TRANSITION_DURATION)
}
_destroyElement(element) {
- $(element)
- .detach()
- .trigger(Event.CLOSED)
- .remove()
+ EventHandler.trigger(element, Event.CLOSED)
+ element.parentNode.removeChild(element)
}
// static
static _jQueryInterface(config) {
return this.each(function () {
Yes but this method is called only when jQuery is present
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#23596 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAVVtZX1v0TCaGXs3KUosfxhl5t6rj5hks5sbCBhgaJpZM4O9UXM>
.
|
b91d0c8 to
f862b8e
Compare
I'm near the end for this plugin
The last thing I have to fix is :
And how folks will user our plugins without jQuery, maybe we should enable to register our plugins to jQuery even if we do not use it anymore 🤔
Work in progress...
@XhmikosR if you want to help me do not hesitate 😄