Bug 248870 - createLink & unLink Command should not make anchor elements with same name attribute
Summary: createLink & unLink Command should not make anchor elements with same name at...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-12-07 05:56 PST by Ahmad Saleem
Modified: 2022-12-14 05:57 PST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ahmad Saleem 2022-12-07 05:56:28 PST
Hi Team,

While going through Blink's comment, I came across another potential which can be merged:

Blink Commit - https://src.chromium.org/viewvc/blink?view=revision&revision=185635

Webkit GitHub Source - https://github.com/WebKit/WebKit/blob/4cc6515988ce049468e3c05836107192648b037a/Source/WebCore/editing/ApplyStyleCommand.cpp#LL1074

Failing Tests (also Fail in Firefox Nightly 109) - https://jsfiddle.net/6rftoakp/show

Appreciate if someone can give input whether matching Chrome behavior is desirable or not?

Thanks!
Comment 1 Ryosuke Niwa 2022-12-07 16:25:31 PST
The patch is oddly specific about name content attribute of anchor element. There are other elements with name attribute. Why are we not considering those? Also, there is nothing wrong with multiple elements to have the same name so I'm not certain if we want to remove name attribute.
Comment 2 Ahmad Saleem 2022-12-09 02:23:06 PST
(In reply to Ryosuke Niwa from comment #1)
> The patch is oddly specific about name content attribute of anchor element.
> There are other elements with name attribute. Why are we not considering
> those? Also, there is nothing wrong with multiple elements to have the same
> name so I'm not certain if we want to remove name attribute.

I think you are right and if I go through Chrome Bug history, it seems that it was impacting "editing-in-js" library effort of trying to move "execCommand" to JS.

Link - https://github.com/yosinch/editing/issues/35

Plus Safari works like this:

> JSFiddle - https://jsfiddle.net/c4817ys2/

> Apply - document.execCommand("createLink", false, "URL");

*** Safari 16.1 & Firefox Nightly 109 ***

True

*** Chrome Canary 110 ***

First run nothing and then second will show "true" similar to Safari & Firefox.
Comment 3 Radar WebKit Bug Importer 2022-12-14 05:57:16 PST
<rdar://problem/103354383>