penguin/AstroJS

Javascript framework for my blog

commit c8210f2468f67fe0845f6f7f9628127fa287bbcc

author斟酌 鵬兄 <tgckpg@gmail.com>
date2022-07-31T17:23:34Z
subjectRevert "Revert prev commit, do not encodeURI on DataKey"
commit c8210f2468f67fe0845f6f7f9628127fa287bbcc
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date:   2022-07-31T17:23:34Z

    Revert "Revert prev commit, do not encodeURI on DataKey"
    
    This reverts commit 04525d1e1ab30a2efe2b44609b09435dcbf0f363.
---
 botanjs/src/Astro/Blog/AstroEdit/SiteLibrary.js | 4 ++--
 botanjs/src/Dandelion/IDOMElement.js            | 2 +-
 botanjs/src/System/utils/DataKey.js             | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/botanjs/src/Astro/Blog/AstroEdit/SiteLibrary.js b/botanjs/src/Astro/Blog/AstroEdit/SiteLibrary.js
index 3478892..848c1f1 100644
--- a/botanjs/src/Astro/Blog/AstroEdit/SiteLibrary.js
+++ b/botanjs/src/Astro/Blog/AstroEdit/SiteLibrary.js
@@ -53,8 +53,8 @@
 			{
 				return [
 					new DataKey("id", data.id)
-					, new DataKey("title", data.name)
-					, new DataKey("author", data.author)
+					, new DataKey("title", decodeURI(data.name))
+					, new DataKey("author", decodeURI(data.author))
 					, new DataKey("hash", data.hash)
 				];
 			}
diff --git a/botanjs/src/Dandelion/IDOMElement.js b/botanjs/src/Dandelion/IDOMElement.js
index 136efb9..8e9345f 100644
--- a/botanjs/src/Dandelion/IDOMElement.js
+++ b/botanjs/src/Dandelion/IDOMElement.js
@@ -96,7 +96,7 @@
 	IDOMElement.prototype.getDAttribute = function(name)
 	{
 		var i = this.getAttribute("data-" + name);
-		return i;
+		return i && decodeURIComponent(i);
 	};
 
 	IDOMElement.prototype.foreach = function(type, callback)
diff --git a/botanjs/src/System/utils/DataKey.js b/botanjs/src/System/utils/DataKey.js
index 18ef075..065a414 100644
--- a/botanjs/src/System/utils/DataKey.js
+++ b/botanjs/src/System/utils/DataKey.js
@@ -7,7 +7,7 @@
 		IKey.call(
 			this
 			, "data-" + name
-			, value ? String( value ) : ""
+			, value ? encodeURIComponent( String( value ) ) : ""
 		);
 	};