Skip to content

v4 Dropdown without jQuery#24099

Merged
Johann-S merged 1 commit intov4-without-jqueryfrom
v4-dropdown-without-jquery
Nov 24, 2017
Merged

v4 Dropdown without jQuery#24099
Johann-S merged 1 commit intov4-without-jqueryfrom
v4-dropdown-without-jquery

Conversation

@Johann-S
Copy link
Copy Markdown
Member

Work in progress...

@Johann-S Johann-S force-pushed the v4-dropdown-without-jquery branch from 7c00ab6 to dab2c3a Compare October 2, 2017 11:52
@Johann-S Johann-S force-pushed the v4-dropdown-without-jquery branch from dab2c3a to 59b5f85 Compare October 2, 2017 12:16
@Johann-S Johann-S mentioned this pull request Oct 2, 2017
45 tasks
@Johann-S Johann-S force-pushed the v4-dropdown-without-jquery branch from 59b5f85 to b5f26c9 Compare October 20, 2017 19:14
Comment thread js/src/dropdown.js
e.stopPropagation()
})
EventHandler.on(document, Event.KEYDOWN_DATA_API, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler)
EventHandler.on(document, Event.KEYDOWN_DATA_API, Selector.MENU, Dropdown._dataApiKeydownHandler)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@alekitto they are an issue here with our current EventHandler because if we have the same delegation handler for a different delegation selector no event listener is added due to that line : https://github.com/twbs/bootstrap/blob/v4-without-jquery/js/src/dom/eventHandler.js#L225

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed by my last commit 👍

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, you're right, I managed to reproduce the error in a test case. PR is coming to fix this.

Comment thread js/src/dom/eventHandler.js Outdated
} else {
addHandler(element, event, complete)
}
realHandler.uid = complete.uid.toString()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Johann-S Adding the uid property to the real handler function will cause troubles when using and removing the same handler for more than one event (like in https://github.com/twbs/bootstrap/blob/v4-without-jquery/js/src/tooltip.js#L322).
It was changed in fa90114 to take this into account, removing the setting of uidEvent property.
I thought that a test was written for this scenario, but i've probably missed it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yep that's because Util.noop always return the same function instead of a new one here but yes in case of a reusable handler it will be problematic

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, with Util.noop shouldn't be a problem 😄
However, #24487 should fix that, but i think you have to revert your last commit in order to merge it. If you can reopen it, I'll submit a couple of tests to cover this case.

@Johann-S Johann-S force-pushed the v4-dropdown-without-jquery branch 2 times, most recently from 15ca804 to ff11028 Compare November 1, 2017 13:46
@Johann-S
Copy link
Copy Markdown
Member Author

Johann-S commented Nov 1, 2017

I'm stuck on this unit test : https://github.com/twbs/bootstrap/blob/v4-dropdown-without-jquery/js/tests/unit/dropdown.js#L598

It seems I don't understand how but when I trigger a click event on the input, the event is swallowed 🤔

@Johann-S Johann-S force-pushed the v4-dropdown-without-jquery branch from ff11028 to 93e8856 Compare November 24, 2017 10:02
@Johann-S Johann-S merged commit b0f3755 into v4-without-jquery Nov 24, 2017
@Johann-S Johann-S deleted the v4-dropdown-without-jquery branch November 24, 2017 10:14
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.

2 participants