Browse Source

BlockClosure >> {asJQuery,asJQueryInContext:}. Fix #1119.

Wraps a function using one-element array.
Herbert Vojčík 9 years ago
parent
commit
8a45a5299a
3 changed files with 62 additions and 0 deletions
  1. 4 0
      API-CHANGES.txt
  2. 50 0
      src/Web.js
  3. 8 0
      src/Web.st

+ 4 - 0
API-CHANGES.txt

@@ -3,6 +3,10 @@
 + Object >>
   + asJQuery
   + asJQueryInContext:
++ BlockClosure >>
+  + asJQuery
+  + asJQueryInContext:
+
 
 0.13.2:
 

+ 50 - 0
src/Web.js

@@ -5397,6 +5397,56 @@ messageSends: ["value:", "onJQuery:"]
 }),
 $globals.BlockClosure);
 
+$core.addMethod(
+$core.method({
+selector: "asJQuery",
+protocol: '*Web',
+fn: function (){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) { 
+//>>excludeEnd("ctx");
+var $1;
+$1=$recv([self])._asJQuery();
+return $1;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"asJQuery",{},$globals.BlockClosure)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "asJQuery\x0a\x09^ {self} asJQuery",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["asJQuery"]
+}),
+$globals.BlockClosure);
+
+$core.addMethod(
+$core.method({
+selector: "asJQueryInContext:",
+protocol: '*Web',
+fn: function (aContext){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) { 
+//>>excludeEnd("ctx");
+var $1;
+$1=$recv([self])._asJQueryInContext_(aContext);
+return $1;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"asJQueryInContext:",{aContext:aContext},$globals.BlockClosure)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aContext"],
+source: "asJQueryInContext: aContext\x0a\x09^ {self} asJQueryInContext: aContext",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["asJQueryInContext:"]
+}),
+$globals.BlockClosure);
+
 $core.addMethod(
 $core.method({
 selector: "asSnippet",

+ 8 - 0
src/Web.st

@@ -1109,6 +1109,14 @@ appendToBrush: aTagBrush
 
 appendToJQuery: aJQuery
 	self value: (HTMLCanvas onJQuery: aJQuery)
+!
+
+asJQuery
+	^ {self} asJQuery
+!
+
+asJQueryInContext: aContext
+	^ {self} asJQueryInContext: aContext
 ! !
 
 !CharacterArray methodsFor: '*Web'!