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
F15527400: D20590.id49122.diff
Tue, Apr 22, 3:22 AM
F15517920: D20590.id.diff
Sat, Apr 19, 9:33 AM
F15515268: D20590.diff
Fri, Apr 18, 9:03 AM
F15465633: D20590.id.diff
Wed, Apr 2, 9:38 PM
F15418747: D20590.diff
Mar 21 2025, 1:14 AM
Unknown Object (File)
Mar 3 2025, 10:02 PM
Unknown Object (File)
Mar 3 2025, 10:01 PM
Unknown Object (File)
Mar 3 2025, 10:01 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