tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject svn commit: r750516 - /tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
Date Thu, 05 Mar 2009 17:22:31 GMT
Author: hlship
Date: Thu Mar  5 17:22:30 2009
New Revision: 750516

URL: http://svn.apache.org/viewvc?rev=750516&view=rev
Log:
TAP5-555: Tapestry.ScriptManager.contains throws error if <script> tag in <head>
has no href

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js?rev=750516&r1=750515&r2=750516&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
Thu Mar  5 17:22:30 2009
@@ -442,9 +442,8 @@
     /**
      * Used to reconstruct a complete URL from a path that is (or may be) relative to window.location.
      * This is used when determining if a JavaScript library or CSS stylesheet has already
been loaded.
-     * Recognizes complete URLs (which are returned unchanged) and absolute paths (which
are prefixed
-     * with the window.location protocol and host).  Otherwise the correct path is built.
 The
-     * path may be prefixed with "./" and "../", which will be resolved correctly.
+     * Recognizes complete URLs (which are returned unchanged), otherwise the URLs are expected
to be
+     * absolute paths.
      *
      * @param path
      * @return complete URL as string
@@ -456,31 +455,14 @@
             return path;
         }
 
-        if (path.startsWith("/"))
-        {
-            var l = window.location;
-            return l.protocol + "//" + l.host + path;
-        }
+        if (! path.startsWith("/")) {
+            Tapestry.error("External path " + path + " does not start with a leading slash.");
 
-        var rootPath = this.stripToLastSlash(window.location.href);
-
-        while (true)
-        {
-            if (path.startsWith("../"))
-            {
-                rootPath = this.stripToLastSlash(rootPath.substr(0, rootPath.length - 1));
-                path = path.substring(3);
-                continue;
-            }
-
-            if (path.startsWith("./"))
-            {
-                path = path.substr(2);
-                continue;
-            }
-
-            return rootPath + path;
+            return path;
         }
+
+        var l = window.location;
+        return l.protocol + "//" + l.host + path;
     },
 
     stripToLastSlash : function(URL)
@@ -1653,7 +1635,7 @@
     initialize : function()
     {
 
-        // Check to see if document.script is supported; if not (for example, FireFox),
+        // Check to see if document.scripts is supported; if not (for example, FireFox),
         // we can fake it.
 
         this.emulated = false;
@@ -1683,7 +1665,7 @@
         {
             var existing = element[prop];
 
-            if (existing.blank()) return false;
+            if (! existing || existing.blank()) return false;
 
             var complete =
                     Prototype.Browser.IE ? Tapestry.rebuildURL(existing) : existing;



Mime
View raw message