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)
Fri, Nov 22, 5:26 PM
Unknown Object (File)
Wed, Nov 20, 11:34 PM
Unknown Object (File)
Mon, Nov 18, 11:24 AM
Unknown Object (File)
Thu, Nov 14, 3:39 AM
Unknown Object (File)
Sun, Nov 10, 11:08 AM
Unknown Object (File)
Wed, Nov 6, 3:08 PM
Unknown Object (File)
Sat, Oct 26, 11:03 PM
Unknown Object (File)
Oct 22 2024, 6:50 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