Skip to main content

Search and Top Navigation

#8877 closed bug (fixed)

Opened December 02, 2012 04:23AM UTC

Closed December 05, 2012 10:19PM UTC

Last modified December 12, 2012 05:22PM UTC

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" );

}

Attachments (0)
Change History (5)

Changed December 04, 2012 03:54AM UTC by tj.vantoll comment:1

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.

Changed December 04, 2012 03:58AM UTC by tj.vantoll comment:2

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

Changed December 05, 2012 10:19PM UTC by Scott González comment:3

resolution: → fixed
status: openclosed

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

Changeset: 1e5662ebe5a27d5ef0b8d60730b21771a2526547

Changed December 09, 2012 03:18AM UTC by tj.vantoll comment:4

#8896 is a duplicate of this ticket.

Changed December 12, 2012 05:22PM UTC by scottgonzalez comment:5

#8903 is a duplicate of this ticket.