Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unlinking algorithm always removes anchor element #246

Open
saschanaz opened this issue May 4, 2020 · 0 comments
Open

Unlinking algorithm always removes anchor element #246

saschanaz opened this issue May 4, 2020 · 0 comments

Comments

@saschanaz
Copy link
Member

We have a behavior difference in Firefox and Chrome where Firefox replaces an anchor with <span> when it has extra attributes while Chrome does not.

Repro: https://bug378931.bmoattachments.org/attachment.cgi?id=263746

Per the unlink command algorithm, it clears the value of the target anchor elements, where it removes href attribute in step 9. And then its step 10 has this note:

If we get past this step, we're something like <b class=foo> where we want to keep the extra attributes, so we stick them on a span.

Per the note the purpose of it is to keep the extra attributes of the element. But then the step says:

If element's specified command value for command is null, return the empty list.

Here, the "specified command value" becomes always null for "unlink" because the previous step just removed href:

If command is "createLink" or "unlink":
If element is an a element and has an href attribute, return the value of that attribute.
Return null.

Since the value is always null, the anchor elements always must disappear regardless of extra attributes.

The spec agrees with Chrome behavior but the note clearly suggests the original intention was for Firefox behavior.

What should be done here? Should Firefox be fixed or the spec?

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

No branches or pull requests

1 participant