Page MenuHomePhabricator

Use "link.getAttribute('href')", not "link.href", to bypass dark browser magic
ClosedPublic

Authored by epriestley on Jun 19 2019, 5:24 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Mar 3, 10:02 PM
Unknown Object (File)
Mon, Mar 3, 10:01 PM
Unknown Object (File)
Mon, Mar 3, 10:01 PM
Unknown Object (File)
Thu, Feb 20, 5:04 AM
Unknown Object (File)
Feb 17 2025, 5:19 PM
Unknown Object (File)
Feb 11 2025, 9:18 AM
Unknown Object (File)
Feb 9 2025, 7:53 AM
Unknown Object (File)
Feb 9 2025, 7:53 AM
Subscribers
None

Details

Summary

Ref T13302. In at least some browsers (including Safari and Chrome), when you write this:

<a href="#">...</a>

...and then access <that node>.href, you get http://local-domain-whatever.com/path/to/current/page# back.

This is wonderful, but not what we want. Access the raw attribute value instead, which is # in all browsers.

Test Plan
  • In Safari, Chrome, and Firefox:
  • Clicked "Edit Subtasks" from a task.
  • Clicked "Select" buttons to select several tasks.
  • Before: Clicking these button incorrectly closed the dialog (because of D20573).
  • After: Clicking these buttons now selects tasks without closing the dialog.

Diff Detail

Repository
rP Phabricator
Branch
close1
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 22992
Build 31556: Run Core Tests
Build 31555: arc lint + arc unit