You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2016/07/17 06:46:44 UTC

[2/2] wicket git commit: WICKET-6204 Copy only the available link attributes in Ajax response

WICKET-6204 Copy only the available link attributes in Ajax response

Fixes #173


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/d38181d8
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/d38181d8
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/d38181d8

Branch: refs/heads/master
Commit: d38181d8af04d3eca1fef0ddcca6ad207689b445
Parents: d3abaf4
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Sun Jul 17 08:37:38 2016 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Sun Jul 17 08:37:38 2016 +0200

----------------------------------------------------------------------
 .../apache/wicket/ajax/res/js/wicket-ajax-jquery.js    | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/d38181d8/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
index 55e6e61..a7aa0d9 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
@@ -2117,17 +2117,18 @@
 						// create link element
 						var css = Wicket.Head.createElement("link");
 
-						// copy required attributes
-						css.id = node.getAttribute("id");
-						css.rel = node.getAttribute("rel");
-						css.href = node.getAttribute("href");
-						css.type = node.getAttribute("type");
+						// copy supplied attributes only.
+						var attributes = $(node).prop("attributes");
+						var $css = $(css);
+						$.each(attributes, function() {
+							$css.attr(this.name, this.value);
+						});
 
 						// add element to head
 						Wicket.Head.addElement(css);
 
 						// cross browser way to check when the css is loaded
-						// taked from http://www.backalleycoder.com/2011/03/20/link-tag-css-stylesheet-load-event/
+						// taken from http://www.backalleycoder.com/2011/03/20/link-tag-css-stylesheet-load-event/
 						// this makes a second GET request to the css but it gets it either from the cache or
 						// downloads just the first several bytes and realizes that the MIME is wrong and ignores the rest
 						var img = document.createElement('img');