Permalink
Browse files

Build 0.8.48 - removing pathname attempted fix for ie

  • Loading branch information...
1 parent 78cf68a commit d00c45397c1c7245b30a3aa22e16add3e781b841 @draeton committed Jan 18, 2012
View
@@ -1,7 +1,7 @@
## Tanchor
[Tanchor](http://draeton.github.com/tanchor/) is a small utility library for working with URLs using the DOM's anchor element.
-The current version is `0.8.47`. Documentation is available
+The current version is `0.8.48`. Documentation is available
[here](http://draeton.github.com/tanchor/tanchor/docs/tanchor.html). Unit tests are available
[here](http://draeton.github.com/tanchor/tanchor/tests/).
@@ -10,7 +10,7 @@ The current version is `0.8.47`. Documentation is available
Tanchor is a single-script utility.
- <script src="js/tanchor-0.8.47-min.js"></script>
+ <script src="js/tanchor-0.8.48-min.js"></script>
## Usage
View
@@ -1,4 +1,4 @@
-#Tue, 17 Jan 2012 21:10:12 -0500
+#Tue, 17 Jan 2012 21:13:32 -0500
build.major=0
build.minor=8
-build.number=47
+build.number=48
Oops, something went wrong.
@@ -255,24 +255,13 @@ var Tanchor = (function (window, document) {
};
};
- /* fix for pathname leading slash in IE */
- var pathnameGetter = function () {
- var val = this.anchor.pathname;
-
- if (!/^\//.test(val)) {
- val = "/" + val;
- }
-
- return val;
- };
-
var nativeMethods = (function () {
var methods = {}, props, prop, i, l;
props = ["href", "protocol", "host", "hostname", "port", "pathname", "search", "hash"];
for (i = 0, l = props.length; i < l; i++) {
prop = props[i];
- methods[prop] = (prop === "pathname") ? pathnameGetter : nativeGetter(prop);
+ methods[prop] = nativeGetter(prop);
}
return methods;
Binary file not shown.
View
@@ -254,24 +254,13 @@
<span class="p">};</span>
<span class="p">};</span>
- <span class="cm">/* fix for pathname leading slash in IE */</span>
- <span class="kd">var</span> <span class="nx">pathnameGetter</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
- <span class="kd">var</span> <span class="nx">val</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">anchor</span><span class="p">.</span><span class="nx">pathname</span><span class="p">;</span>
-
- <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="sr">/^\//</span><span class="p">.</span><span class="nx">test</span><span class="p">(</span><span class="nx">val</span><span class="p">))</span> <span class="p">{</span>
- <span class="nx">val</span> <span class="o">=</span> <span class="s2">&quot;/&quot;</span> <span class="o">+</span> <span class="nx">val</span><span class="p">;</span>
- <span class="p">}</span>
-
- <span class="k">return</span> <span class="nx">val</span><span class="p">;</span>
- <span class="p">};</span>
-
<span class="kd">var</span> <span class="nx">nativeMethods</span> <span class="o">=</span> <span class="p">(</span><span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">methods</span> <span class="o">=</span> <span class="p">{},</span> <span class="nx">props</span><span class="p">,</span> <span class="nx">prop</span><span class="p">,</span> <span class="nx">i</span><span class="p">,</span> <span class="nx">l</span><span class="p">;</span>
<span class="nx">props</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;href&quot;</span><span class="p">,</span> <span class="s2">&quot;protocol&quot;</span><span class="p">,</span> <span class="s2">&quot;host&quot;</span><span class="p">,</span> <span class="s2">&quot;hostname&quot;</span><span class="p">,</span> <span class="s2">&quot;port&quot;</span><span class="p">,</span> <span class="s2">&quot;pathname&quot;</span><span class="p">,</span> <span class="s2">&quot;search&quot;</span><span class="p">,</span> <span class="s2">&quot;hash&quot;</span><span class="p">];</span>
<span class="k">for</span> <span class="p">(</span><span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="nx">l</span> <span class="o">=</span> <span class="nx">props</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">l</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">prop</span> <span class="o">=</span> <span class="nx">props</span><span class="p">[</span><span class="nx">i</span><span class="p">];</span>
- <span class="nx">methods</span><span class="p">[</span><span class="nx">prop</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="nx">prop</span> <span class="o">===</span> <span class="s2">&quot;pathname&quot;</span><span class="p">)</span> <span class="o">?</span> <span class="nx">pathnameGetter</span> <span class="o">:</span> <span class="nx">nativeGetter</span><span class="p">(</span><span class="nx">prop</span><span class="p">);</span>
+ <span class="nx">methods</span><span class="p">[</span><span class="nx">prop</span><span class="p">]</span> <span class="o">=</span> <span class="nx">nativeGetter</span><span class="p">(</span><span class="nx">prop</span><span class="p">);</span>
<span class="p">}</span>
<span class="k">return</span> <span class="nx">methods</span><span class="p">;</span>
View
@@ -255,24 +255,13 @@ var Tanchor = (function (window, document) {
};
};
- /* fix for pathname leading slash in IE */
- var pathnameGetter = function () {
- var val = this.anchor.pathname;
-
- if (!/^\//.test(val)) {
- val = "/" + val;
- }
-
- return val;
- };
-
var nativeMethods = (function () {
var methods = {}, props, prop, i, l;
props = ["href", "protocol", "host", "hostname", "port", "pathname", "search", "hash"];
for (i = 0, l = props.length; i < l; i++) {
prop = props[i];
- methods[prop] = (prop === "pathname") ? pathnameGetter : nativeGetter(prop);
+ methods[prop] = nativeGetter(prop);
}
return methods;
View
@@ -81,10 +81,13 @@
expect(props.length);
- var t = new Tanchor(location);
+ var t = new Tanchor(DEFAULT_URL);
+
+ var a = document.createElement("a");
+ a.href = DEFAULT_URL;
while (prop = props[i++]) {
- equal(t[prop](), location[prop], "t." + prop + "()");
+ equal(t[prop](), a[prop], "t." + prop + "() equals a." + prop);
}
});

0 comments on commit d00c453

Please sign in to comment.