#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 10 years ago by
Status: | new → open |
---|---|
Summary: | isLocal function issue → Tabs: isLocal function issue in Safari 5.1.7 |
comment:3 Changed 10 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
Tabs: Decode URIs before comparing. Fixes #8877 - Tabs: isLocal function issue in Safari 5.1.7.
Changeset: 1e5662ebe5a27d5ef0b8d60730b21771a2526547
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.