Browse Source

HTMLCanvas >> entity: without jQuery.

Herby Vojčík 4 years ago
parent
commit
e3b700f283
2 changed files with 12 additions and 12 deletions
  1. 11 11
      src/Web.js
  2. 1 1
      src/Web.st

+ 11 - 11
src/Web.js

@@ -718,20 +718,20 @@ var result;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-var $2,$4,$3,$1,$5;
-$2="<span />"._asJQuery();
-$4="&".__comma(aString);
+var $1,$3,$2,$4;
+$1=$recv($recv($globals.TagBrush)._fromString_("span"))._asDomNode();
+$3="&".__comma(aString);
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.sendIdx[","]=2;
 //>>excludeEnd("ctx");
-$3=$recv($4).__comma(";");
+$2=$recv($3).__comma(";");
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.sendIdx[","]=1;
 //>>excludeEnd("ctx");
-$1=$recv($2)._html_($3);
-result=$recv($1)._text();
-$5=$recv($recv(result)._size()).__eq((1));
-if(!$core.assert($5)){
+$recv($1)._innerHTML_($2);
+result=$recv($1)._textContent();
+$4=$recv($recv(result)._size()).__eq((1));
+if(!$core.assert($4)){
 $self._error_("Not an HTML entity: ".__comma(aString));
 }
 $self._with_(result);
@@ -742,11 +742,11 @@ return self;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["aString"],
-source: "entity: aString\x0a\x09\x22Adds a character representing html entity, eg.\x0a\x09html entity: 'copy'\x0a\x09adds a copyright sign.\x0a\x09If a name does not represent valid HTML entity, error is raised.\x22\x0a\x09| result |\x0a\x09result := ('<span />' asJQuery html: '&', aString, ';') text.\x0a\x09result size = 1 ifFalse: [ self error: 'Not an HTML entity: ', aString ].\x0a\x09self with: result",
-referencedClasses: [],
+source: "entity: aString\x0a\x09\x22Adds a character representing html entity, eg.\x0a\x09html entity: 'copy'\x0a\x09adds a copyright sign.\x0a\x09If a name does not represent valid HTML entity, error is raised.\x22\x0a\x09| result |\x0a\x09result := (TagBrush fromString: 'span') asDomNode innerHTML: '&', aString, ';'; textContent.\x0a\x09result size = 1 ifFalse: [ self error: 'Not an HTML entity: ', aString ].\x0a\x09self with: result",
+referencedClasses: ["TagBrush"],
 //>>excludeEnd("ide");
 pragmas: [],
-messageSends: ["text", "html:", "asJQuery", ",", "ifFalse:", "=", "size", "error:", "with:"]
+messageSends: ["innerHTML:", "asDomNode", "fromString:", ",", "textContent", "ifFalse:", "=", "size", "error:", "with:"]
 }),
 $globals.HTMLCanvas);
 

+ 1 - 1
src/Web.st

@@ -39,7 +39,7 @@ entity: aString
 	adds a copyright sign.
 	If a name does not represent valid HTML entity, error is raised."
 	| result |
-	result := ('<span />' asJQuery html: '&', aString, ';') text.
+	result := (TagBrush fromString: 'span') asDomNode innerHTML: '&', aString, ';'; textContent.
 	result size = 1 ifFalse: [ self error: 'Not an HTML entity: ', aString ].
 	self with: result
 !