You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ha...@apache.org on 2018/03/27 22:34:18 UTC
[royale-asjs] branch feature/layout-optimization updated: Slight
memory and performance improvement
This is an automated email from the ASF dual-hosted git repository.
harbs pushed a commit to branch feature/layout-optimization
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/feature/layout-optimization by this push:
new a2d166a Slight memory and performance improvement
a2d166a is described below
commit a2d166aec82a986f4a8cffbdd488f6b08d3467b6
Author: Harbs <ha...@in-tools.com>
AuthorDate: Wed Mar 28 01:34:11 2018 +0300
Slight memory and performance improvement
---
.../projects/Language/src/main/royale/QName.as | 46 ++++++++++++----------
frameworks/projects/XML/src/main/royale/XML.as | 7 +++-
2 files changed, 31 insertions(+), 22 deletions(-)
diff --git a/frameworks/projects/Language/src/main/royale/QName.as b/frameworks/projects/Language/src/main/royale/QName.as
index 057b9d5..fe34d5f 100644
--- a/frameworks/projects/Language/src/main/royale/QName.as
+++ b/frameworks/projects/Language/src/main/royale/QName.as
@@ -20,6 +20,9 @@ package
{
public class QName
{
+ /**
+ * @royaleignorecoercion Namespace
+ */
COMPILE::JS
public function QName(qNameOrUri:*=null,localNameVal:*=null)
{
@@ -44,27 +47,30 @@ package
b. Let q.uri = Namespace.uri NOTE implementations that preserve prefixes in qualified names may also set q.[[Prefix]] to Namespace.prefix
8. Return q
*/
- if(qNameOrUri is QName)
+ if(qNameOrUri != null)
{
- _uri = qNameOrUri.uri;
- _localName = qNameOrUri.localName;
- _prefix = qNameOrUri.prefix;
- }
- else if(qNameOrUri is Namespace)
- {
- _uri = (qNameOrUri as Namespace).uri;
- _prefix = (qNameOrUri as Namespace).prefix;
- if(localNameVal)
- _localName = localNameVal.toString();
- }
- else if(localNameVal)
- {
- _localName = localNameVal;
- _uri = qNameOrUri;
- }
- else if (qNameOrUri && qNameOrUri.toString())
- {
- _localName = qNameOrUri.toString();
+ if(qNameOrUri is QName)
+ {
+ _uri = qNameOrUri.uri;
+ _localName = qNameOrUri.localName;
+ _prefix = qNameOrUri.prefix;
+ }
+ else if(qNameOrUri is Namespace)
+ {
+ _uri = (qNameOrUri as Namespace).uri;
+ _prefix = (qNameOrUri as Namespace).prefix;
+ if(localNameVal)
+ _localName = localNameVal.toString();
+ }
+ else if(localNameVal)
+ {
+ _localName = localNameVal;
+ _uri = qNameOrUri;
+ }
+ else if (qNameOrUri && qNameOrUri.toString())
+ {
+ _localName = qNameOrUri.toString();
+ }
}
}
diff --git a/frameworks/projects/XML/src/main/royale/XML.as b/frameworks/projects/XML/src/main/royale/XML.as
index 60b95ae..1f1de73 100644
--- a/frameworks/projects/XML/src/main/royale/XML.as
+++ b/frameworks/projects/XML/src/main/royale/XML.as
@@ -384,12 +384,15 @@ package
);
}
+ private static var xmlRegEx:RegExp = /&(?![\w]+;)/g;
+ private static var parser:DOMParser;
private static var errorNS:String;
private function parseXMLStr(xml:String):void
{
//escape ampersands
- xml = xml.replace(/&(?![\w]+;)/g,"&");
- var parser:DOMParser = new DOMParser();
+ xml = xml.replace(xmlRegEx,"&");
+ if(!parser)
+ parser = new DOMParser();
if(errorNS == null)
{
// get error namespace. It's different in different browsers.
--
To stop receiving notification emails like this one, please contact
harbs@apache.org.