define(["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict"; if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil; if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver; var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals; if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu; $core.addPackage("Platform-DOM"); $core.packages["Platform-DOM"].innerEval = function (expr) { return eval(expr); }; $core.packages["Platform-DOM"].transport = {"type":"amd","amdNamespace":"amber_core"}; $core.addClass("PlatformDom", $globals.Object, [], "Platform-DOM"); $core.addMethod( $core.method({ selector: "isDomNode:", protocol: "testing", fn: function (anObject){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); return anObject.nodeType > 0 && Object.prototype.toString.call(anObject) !== "[object Object]"; return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"isDomNode:",{anObject:anObject},$globals.PlatformDom.a$cls)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["anObject"], source: "isDomNode: anObject\x0a 0 &&\x0a\x09\x09Object.prototype.toString.call(anObject) !== \x22[object Object]\x22\x0a'>", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.PlatformDom.a$cls); $core.addMethod( $core.method({ selector: "isFeasible", protocol: "testing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); if (typeof document === "undefined") return false; try { var d = document.createElement("div"), f = document.createDocumentFragment(), t = document.createTextNode("Hello, Amber!"); f.appendChild(t); d.insertBefore(f, null); return d.innerHTML === "Hello, Amber!"; } catch (e) { return false; }; return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.PlatformDom.a$cls)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isFeasible\x0a", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.PlatformDom.a$cls); $core.addMethod( $core.method({ selector: "newCustomEvent:detail:", protocol: "creation", fn: function (aString,anObject){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); return new CustomEvent(aString, {detail: anObject}); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"newCustomEvent:detail:",{aString:aString,anObject:anObject},$globals.PlatformDom.a$cls)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString", "anObject"], source: "newCustomEvent: aString detail: anObject\x0a", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.PlatformDom.a$cls); $core.addMethod( $core.method({ selector: "toArray:", protocol: "converting", fn: function (aDomList){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); return Array.prototype.slice.call(aDomList); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"toArray:",{aDomList:aDomList},$globals.PlatformDom.a$cls)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aDomList"], source: "toArray: aDomList\x0a", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.PlatformDom.a$cls); $core.addMethod( $core.method({ selector: "asDomNode", protocol: "*Platform-DOM", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); return $recv(document)._createTextNode_($self._asString()); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.CharacterArray)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asDomNode\x0a\x09^ document createTextNode: self asString", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["createTextNode:", "asString"] }), $globals.CharacterArray); $core.addMethod( $core.method({ selector: "asDomNode", protocol: "*Platform-DOM", fn: function (){ var self=this,$self=this; var fragment; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); fragment=$recv(document)._createDocumentFragment(); $self._do_((function(each){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); return $recv(fragment)._appendChild_($recv(each)._asDomNode()); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); //>>excludeEnd("ctx"); })); return fragment; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asDomNode",{fragment:fragment},$globals.Collection)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asDomNode\x0a\x09| fragment |\x0a\x09fragment := document createDocumentFragment.\x0a\x09self do: [ :each | fragment appendChild: each asDomNode ].\x0a\x09^ fragment", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["createDocumentFragment", "do:", "appendChild:", "asDomNode"] }), $globals.Collection); $core.addMethod( $core.method({ selector: "asDomNode", protocol: "*Platform-DOM", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1,$2; $1=$recv($globals.PlatformDom)._isDomNode_($self["@jsObject"]); if($core.assert($1)){ return $self["@jsObject"]; } else { $2=( //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, //>>excludeEnd("ctx"); ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._asDomNode.apply($self, [])); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; //>>excludeEnd("ctx");; return $2; } return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.JSObjectProxy)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "asDomNode\x0a\x09(PlatformDom isDomNode: jsObject)\x0a\x09\x09ifTrue: [ ^ jsObject ]\x0a\x09\x09ifFalse: [ ^ super asDomNode ]", referencedClasses: ["PlatformDom"], //>>excludeEnd("ide"); messageSends: ["ifTrue:ifFalse:", "isDomNode:", "asDomNode"] }), $globals.JSObjectProxy); $core.addMethod( $core.method({ selector: "htmlTextContent", protocol: "*Platform-DOM", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var d=document.createElement("div");d.innerHTML=self;return d.textContent||d.innerText;; return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"htmlTextContent",{},$globals.String)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "htmlTextContent\x0a", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.String); });