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
F18787233: D20590.diff
Tue, Oct 14, 10:42 PM
F18733980: D20590.id.diff
Tue, Sep 30, 10:46 PM
F18583182: D20590.id.diff
Sep 11 2025, 9:45 AM
F18570521: D20590.id49122.diff
Sep 10 2025, 3:27 AM
F18570519: D20590.id49120.diff
Sep 10 2025, 3:27 AM
F18567037: D20590.id.diff
Sep 9 2025, 3:28 PM
F18513264: D20590.diff
Sep 5 2025, 9:19 AM
F18100567: D20590.diff
Aug 9 2025, 11:56 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
Lint
Lint Not Applicable
Unit
Tests Not Applicable