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
F19304215: D20590.id49122.diff
Wed, Dec 24, 8:05 AM
F19112360: D20590.diff
Tue, Dec 9, 5:00 PM
F19083000: D20590.id49122.diff
Dec 2 2025, 12:28 PM
F19025191: D20590.diff
Nov 24 2025, 5:37 AM
F18985128: D20590.id49120.diff
Nov 17 2025, 12:54 PM
F18941178: D20590.id.diff
Nov 11 2025, 9:41 AM
F18832162: D20590.id49122.diff
Oct 25 2025, 7:45 PM
F18829198: D20590.id49122.diff
Oct 24 2025, 8:33 PM
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