Explorar o código

Convenience: #newSvgElement.

Herby Vojčík %!s(int64=4) %!d(string=hai) anos
pai
achega
8133da940a
Modificáronse 2 ficheiros con 30 adicións e 0 borrados
  1. 24 0
      src/Silk.js
  2. 6 0
      src/Silk.st

+ 24 - 0
src/Silk.js

@@ -183,6 +183,30 @@ messageSends: ["ifNil:", "tryMakeDnuElement:", "doesNotUnderstand:"]
 }),
 $globals.TSilkBuilder);
 
+$core.addMethod(
+$core.method({
+selector: "newSvgElement",
+protocol: "convenience",
+fn: function (){
+var self=this,$self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+return $self._newElement_xmlns_("svg","http://www.w3.org/2000/svg");
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"newSvgElement",{})});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "newSvgElement\x0a\x09^ self newElement: 'svg' xmlns: 'http://www.w3.org/2000/svg'",
+referencedClasses: [],
+//>>excludeEnd("ide");
+pragmas: [],
+messageSends: ["newElement:xmlns:"]
+}),
+$globals.TSilkBuilder);
+
 $core.addMethod(
 $core.method({
 selector: "tryMakeDnuElement:",

+ 6 - 0
src/Silk.st

@@ -105,6 +105,12 @@ I contain Silk's "build element via DNU" behaviour.
 
 I expect #namespace and #newElement:xmns: to be implemented.!
 
+!TSilkBuilder methodsFor: 'convenience'!
+
+newSvgElement
+	^ self newElement: 'svg' xmlns: 'http://www.w3.org/2000/svg'
+! !
+
 !TSilkBuilder methodsFor: 'instance creation'!
 
 tryMakeDnuElement: aMessage