Skip to content

Rewritten tab without jquery#24094

Merged
Johann-S merged 1 commit intotwbs:v4-without-jqueryfrom
alekitto:tab-without-jquery
Nov 26, 2017
Merged

Rewritten tab without jquery#24094
Johann-S merged 1 commit intotwbs:v4-without-jqueryfrom
alekitto:tab-without-jquery

Conversation

@alekitto
Copy link
Copy Markdown
Contributor

Related to #23586

Comment thread js/src/dom/selectorEngine.js Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread js/src/tab.js Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you changed that selector ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

> li > .active is not a valid selector. Using with querySelector/querySelectorAll throws a SyntaxError.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep so you should find li children and after that .active elements, no need here to implement :scope

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, can't understand. Are you suggesting not to use a selector? Or a double use of .children? In both cases it could be very slow

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope you're right that's better like that, sorry I didn't know :scope before your PR 😄

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing indicates that :scope selector has been deprecated. It is part of the CSS Selectors Level 4 Working Draft. Some browsers have removed the scoped style tag attribute, but the :scope pseudo-class is still supported and works correctly in CSS (works the same as :root) and in querySelector/querySelectorAll

Comment thread js/src/dom/selectorEngine.js Outdated
Copy link
Copy Markdown
Member

@Johann-S Johann-S Sep 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should merge those two if (with the other one above this one)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

Comment thread js/src/dom/selectorEngine.js Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this polyfill come from MDN, why did you change that ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are failing with that if. In any case, the DOM Standard specification (https://dom.spec.whatwg.org/#dom-element-closest) doesn't require the element to be a discendant of the document object

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's right but I don't see a use case where the element should be outside of the document.documentElement 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably some tests don't add elements to the DOM before execution. If you prefer, I can revert this change and fix those tests.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No that's ok 👍

Comment thread js/src/dom/selectorEngine.js Outdated
Copy link
Copy Markdown
Member

@Johann-S Johann-S Sep 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a big fan of that, because if it's an ID you'll use querySelector instead of getElementById which is faster

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiple selector starting with # (ex: #id > li, #id1 > .active) will match and return a wrong result

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, I think this is in the wrong PR, i've encountered an error on this while working on ScrollSpy 😅

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Johann-S Should I revert this? Or fix testing the selector against a regex that excludes complex selectors?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope finally I think it's fine like this 👍

@alekitto alekitto force-pushed the tab-without-jquery branch 2 times, most recently from 1253847 to ff0ef42 Compare October 2, 2017 17:58
@Johann-S Johann-S force-pushed the v4-without-jquery branch 2 times, most recently from e692aa3 to ab6c322 Compare October 20, 2017 19:16
@Johann-S
Copy link
Copy Markdown
Member

@alekitto can you update your branch please ? 👍

@alekitto
Copy link
Copy Markdown
Contributor Author

@Johann-S done 👍

Comment thread js/src/tab.js Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems an unrelated change here 🤔 Maybe can you explain it ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check was introduced to fix fading when no initial panel was active, but i've probably missed a test. I'll push it asap, but if you want to keep things separated, i can revert this check and submit a pr just for this case.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it an issue in our current v4-dev branch ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve just tested it on the v4-dev, the issue is present in the visual test page

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I prefer if you can create a PR (which target v4-dev) to resolve that or if you can create an issue which describe that

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. I've pushed a PR to explain and resolve the issue on v4-dev branch

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reverted this change for this PR, as it is not related

@Johann-S Johann-S merged commit 2a48a82 into twbs:v4-without-jquery Nov 26, 2017
@Johann-S Johann-S mentioned this pull request Jul 19, 2018
45 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants