Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#8877 closed bug (fixed)

Tabs: isLocal function issue in Safari 5.1.7

Reported by: madogai Owned by:
Priority: minor Milestone: 1.10.0
Component: ui.tabs Version: 1.9.2
Keywords: Cc:
Blocked by: Blocking:

Description

It is a problem that occurs in Safari 5.1.7.
If it contains double-byte characters in the URL, failed to determine the isLocal.
This is because the value of the href attribute of the A tag returns and location.href is different.

I've included a sample below. (jsFiddle does not choose the URL, I created on Github page)
http://madguy.github.com/ほげ.html

"location.href" returned "http://madguy.github.com/ほげ.html".
"$('a')[0].href" returned "http://madguy.github.com/%E3%81%BB%E3%81%92.html#tab-1".

Due to differences in URL encoding, the determination of isLocal would become false.

To be on the safe side, I will describe the modification you have made me.

regards.

---before fix---

function isLocal( anchor ) {

return anchor.hash.length > 1 &&

anchor.href.replace( rhash, "" ) ===

location.href.replace( rhash, "" )

support: Safari 5.1 Safari 5.1 doesn't encode spaces in window.location but it does encode spaces from anchors (#8777) .replace( /\s/g, "%20" );

}

---after fix---

function isLocal( anchor ) {

return anchor.hash.length > 1 &&

decodeURIComponent(anchor.href).replace( rhash, "" ) ===

decodeURIComponent(location.href).replace( rhash, "" )

support: Safari 5.1 Safari 5.1 doesn't encode spaces in window.location but it does encode spaces from anchors (#8777) .replace( /\s/g, "%20" );

}

Change History (5)

comment:1 Changed 7 years ago by tj.vantoll

Status: newopen
Summary: isLocal function issueTabs: isLocal function issue in Safari 5.1.7

I tried the test page locally and I see the described behavior in Safari 5.1.7. This issue does not occur in Safari 6 nor a few other browsers I tested. This seems to be a very similar problem to #8777.

comment:2 Changed 7 years ago by tj.vantoll

I also verified that the provided fix does indeed fix the issue.

comment:3 Changed 7 years ago by Scott González

Resolution: fixed
Status: openclosed

Tabs: Decode URIs before comparing. Fixes #8877 - Tabs: isLocal function issue in Safari 5.1.7.

Changeset: 1e5662ebe5a27d5ef0b8d60730b21771a2526547

comment:4 Changed 7 years ago by tj.vantoll

#8896 is a duplicate of this ticket.

comment:5 Changed 7 years ago by Scott González

#8903 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.