Search and Top Navigation
#4941 closed bug (fixed)
Opened November 03, 2009 10:09PM UTC
Closed August 11, 2011 08:49PM UTC
Mishandling of base tag
Reported by: | ZeK | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.9.0 |
Component: | ui.tabs | Version: | 1.8a1 |
Keywords: | base tabs baseurl ui bug | Cc: | |
Blocked by: | Blocking: |
Description
Hello,
i have some troubles with tabs, it doesn't manage well the base tag.
Let's say i have a page on http://www.domain.com/dir/page.html and i set a base like this :
<base href="http://www.domain.com/" />
So, if i want to have tabs, my link will look like this :
<a href="dir/page.html#mytab">My Tab</a>
But, jquery considers the tab like a remote tab.
The code is in ui.tabs.js, line 91 (on 1.8a1) :
if (hrefBase && (hrefBase === location.toString().split('#')[0] || (baseEl = $('base')[0]) && hrefBase === baseEl.href)) {
In my example :
- baseEl.href = "http://www.domain.com/"
- hrefBase = "dir/page.html"
- location.toString().split('#')[0] = "http://www.domain.com/dir/page.html"
I can't find any example where the second line could be true. But, what could work for the base, is that :
(baseEl = $('base')[0]) && location.toString().split('#')[0] == baseEl.href+hrefBase
I tested it, works in my case.
Thanks.
Attachments (0)
Change History (4)
Changed November 03, 2009 10:51PM UTC by comment:1
Changed November 17, 2009 06:13PM UTC by comment:2
milestone: | TBD → 1.8 |
---|
Consider using the same-domain check used by jQuery core for JSONP.
Changed January 10, 2011 02:25PM UTC by comment:3
_comment0: | Here is how i fix this issue. The ZeK solution won't work for me : \ {{{ \ // inline tab \ if( $('base')[0] ) { \ var locHref = location.href; \ nvar pURL = locHref.replace($('base')[0].href, '/'); \ } \ if (fragmentId.test(href) || \ $('base')[0] && pURL == hrefBase ) { \ self.panels = self.panels.add(self._sanitizeSelector(a.hash)); \ } \ }}} \ I test if the hrefed page is the current page... So i think it is a good way to solve this problem... → 1294669705861769 |
---|
Here is how i fix this issue. The ZeK solution didn't works for me :
// inline tab if( $('base')[0] ) { var locHref = location.href; nvar pURL = locHref.replace($('base')[0].href, '/'); } if (fragmentId.test(href) || $('base')[0] && pURL == hrefBase ) { self.panels = self.panels.add(self._sanitizeSelector(a.hash)); }
I test if the hrefed page is the current page... So i think it is a good way to solve this problem...
My solution was a messy solution (it modifies the URL)
What seems to work better line 97 :
Changed by :