1
0
Jelajahi Sumber

PlatformDom >> newElement:namespace:

Herbert Vojčík 7 tahun lalu
induk
melakukan
4bde1e2380
3 mengubah file dengan 29 tambahan dan 0 penghapusan
  1. 1 0
      API-CHANGES.txt
  2. 24 0
      src/Platform-DOM.js
  3. 4 0
      src/Platform-DOM.st

+ 1 - 0
API-CHANGES.txt

@@ -8,6 +8,7 @@
   + isDomNode:
   + newDocumentFragment
   + newElement:
+  + newElement:namespace:
   + newTextNode:
   + newCustomEvent:detail:
   + toArray:

+ 24 - 0
src/Platform-DOM.js

@@ -141,6 +141,30 @@ messageSends: []
 }),
 $globals.PlatformDom.klass);
 
+$core.addMethod(
+$core.method({
+selector: "newElement:namespace:",
+protocol: 'node creation',
+fn: function (aString,anotherString){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+return document.createElementNS(anotherString,aString);
+return self;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"newElement:namespace:",{aString:aString,anotherString:anotherString},$globals.PlatformDom.klass)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aString", "anotherString"],
+source: "newElement: aString namespace: anotherString \x0a<inlineJS: 'return document.createElementNS(anotherString,aString)'>",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: []
+}),
+$globals.PlatformDom.klass);
+
 $core.addMethod(
 $core.method({
 selector: "newTextNode:",

+ 4 - 0
src/Platform-DOM.st

@@ -23,6 +23,10 @@ newElement: aString
 <inlineJS: 'return document.createElement(aString)'>
 !
 
+newElement: aString namespace: anotherString 
+<inlineJS: 'return document.createElementNS(anotherString,aString)'>
+!
+
 newTextNode: aString
 <inlineJS: 'return document.createTextNode(aString)'>
 ! !