This is an automated email from the ASF dual-hosted git repository.

thiagohp pushed a commit to branch feature/coffeescript-to-typescript
in repository https://gitbox.apache.org/repos/asf/tapestry-5.git


The following commit(s) were added to 
refs/heads/feature/coffeescript-to-typescript by this push:
     new f8f62eaff TAP5-2804: jQuery fixes
f8f62eaff is described below

commit f8f62eaffc8a307b80a1975cf02209813126623f
Author: Thiago H. de Paula Figueiredo <[email protected]>
AuthorDate: Sun May 25 17:38:33 2025 -0300

    TAP5-2804: jQuery fixes
---
 .../main/typescript/src/t5/core/t5-core-dom-jquery.ts   | 17 +++++++++--------
 .../src/test/resources/META-INF/assets/zonedemo.js      |  2 +-
 .../resources/META-INF/modules/app/multi-zone-update.js |  2 +-
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git 
a/tapestry-core/src/main/typescript/src/t5/core/t5-core-dom-jquery.ts 
b/tapestry-core/src/main/typescript/src/t5/core/t5-core-dom-jquery.ts
index 39afe9da9..e730b8b1a 100644
--- a/tapestry-core/src/main/typescript/src/t5/core/t5-core-dom-jquery.ts
+++ b/tapestry-core/src/main/typescript/src/t5/core/t5-core-dom-jquery.ts
@@ -302,7 +302,7 @@ class JQueryElementWrapper implements ElementWrapper {
   };
 
   on(events: string, match: string | null, handler: OnEventHandler): 
ElementWrapper {
-    onevent($(this.element), events, match, handler);
+    on(this.element, events, match, handler);
     return this;
   };
 
@@ -312,6 +312,10 @@ class JQueryElementWrapper implements ElementWrapper {
 
 };
 
+const newElementWrapper = function(element: JQuery) {
+  return new JQueryElementWrapper(element);
+}
+
 class JQueryRequestWrapper implements RequestWrapper {
   readonly jqxhr: JQueryXHR;
 
@@ -352,15 +356,16 @@ const wrapElement = function(element: HTMLElement | 
string): ElementWrapper | nu
   let e: Element | null;
   if (_.isString(element)) {
     e = document.getElementById(element);
-    if (element == null) {
+    if (e == null) {
       return null;
     }
   } else {
-    if (!element) {
+    e = element;
+    if (!e) {
       throw new Error("Attempt to wrap a null DOM element");
     }
   }
-  return newElementWrapper($(element));
+  return newElementWrapper($(e));
 };
 
 const body = wrapElement(document.body);
@@ -438,10 +443,6 @@ let scanner = function(selector: string, callback: (e: 
ElementWrapper) => void)
   scanners.push(scan);
 };
 
-const newElementWrapper = function(element: JQuery) {
-  return new JQueryElementWrapper(element);
-}
-
 const createElement = function(elementName: string, attributes?: object, 
body?: AddableContent): ElementWrapper {
   var element: ElementWrapper;
   if (_.isObject(elementName)) {
diff --git a/tapestry-core/src/test/resources/META-INF/assets/zonedemo.js 
b/tapestry-core/src/test/resources/META-INF/assets/zonedemo.js
index 1f672aa66..9ab069ff9 100644
--- a/tapestry-core/src/test/resources/META-INF/assets/zonedemo.js
+++ b/tapestry-core/src/test/resources/META-INF/assets/zonedemo.js
@@ -4,4 +4,4 @@
  * Full docs: 
https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
  */
 require(["t5/core/dom", "t5/core/events"],
-  (dom, events) => dom.onDocument(events.zone.didUpdate, () => 
(dom("zone-update-message")).update("Zone updated.")));
+  (dom, events) => dom.default.onDocument(events.default.zone.didUpdate, () => 
(dom.default("zone-update-message")).update("Zone updated.")));
diff --git 
a/tapestry-core/src/test/resources/META-INF/modules/app/multi-zone-update.js 
b/tapestry-core/src/test/resources/META-INF/modules/app/multi-zone-update.js
index fe7f69446..1b6ee4e26 100644
--- a/tapestry-core/src/test/resources/META-INF/modules/app/multi-zone-update.js
+++ b/tapestry-core/src/test/resources/META-INF/modules/app/multi-zone-update.js
@@ -1,5 +1,5 @@
 define(["t5/core/dom"], function (dom) {
     return function (id, message) {
-        dom(id).update(message);
+        dom.default(id).update(message);
     };
 });
\ No newline at end of file

Reply via email to