Skip to content

Midair Collision: Fix issue where binding an href and an onclick together could fail.#1692

Merged
Shadowfiend merged 2 commits into
masterfrom
midair-collision
Apr 19, 2015
Merged

Midair Collision: Fix issue where binding an href and an onclick together could fail.#1692
Shadowfiend merged 2 commits into
masterfrom
midair-collision

Conversation

@Shadowfiend
Copy link
Copy Markdown
Member

This only manifested when the onclick came before the href on an
a element, and probably also manifested if you bound an onsubmit
on a form that had an action attribute. The cause was just that I had
forgotten to properly pass on already-seen event attributes when
processing the href attributes, so we lost them.

Fixes #1691 .

This particularly manifested when the attribute whose href we wanted to fix
(e.g., the `href` attribute on an `a` element or the `action` attribute on a
`form` element) also had an event handler (e.g. `onclick`). The code that fixed
the href failed to pass on the event handlers that had been seen so far to the
attribute-fixing chain, so they got lost before they could be applied.
We were calling fixAttrs with attrs.next in five places, which meant it was a
bit error prone. We now do it up front so the call can be changed in one place.
@fmpwizard fmpwizard added this to the 3.0-M6 milestone Mar 22, 2015
@andreak
Copy link
Copy Markdown
Member

andreak commented Mar 22, 2015

+1

Works for me.

@Shadowfiend
Copy link
Copy Markdown
Member Author

Okay, all passing, so let's do it.

Shadowfiend added a commit that referenced this pull request Apr 19, 2015
Midair Collision: Fix issue where binding an `href` and an `onclick` together could fail.

This only manifested when the onclick came before the href on an
a element, and probably also manifested if you bound an onsubmit
on a form that had an action attribute. The cause was just that I had
forgotten to properly pass on already-seen event attributes when
processing the href attributes, so we lost them.
@Shadowfiend Shadowfiend merged commit d105fbb into master Apr 19, 2015
@Shadowfiend Shadowfiend deleted the midair-collision branch April 19, 2015 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

onclick event-handlers are not proparly applied on a-tags when href="#"

3 participants