cincheo / jsweet

A Java to JavaScript transpiler.
http://www.jsweet.org
Other
1.45k stars 159 forks source link

getElementsByTagName does not compile on An element #692

Open Icare67 opened 3 years ago

Icare67 commented 3 years ago

I try to use getElementsByTagName on an Element. See the two test at the bottom of this quickstart sample The following code does not compile: `package quickstart;

import static def.dom.Globals.alert; import static def.dom.Globals.document; import static def.jquery.Globals.$;

import java.util.ArrayList; import java.util.List;

import org.w3c.dom.NamedNodeMap;

import def.dom.HTMLCollectionOf; import def.dom.NodeListOf; import def.dom.HTMLDivElement; import def.js.Array; import jsweet.util.StringTypes;

import java.awt.Graphics2D; /**

} `

lgrignon commented 3 years ago

Are you sure you are using the latest jsweet-core please?

Did you read this: https://github.com/cincheo/jsweet/issues/587 ?

Icare67 commented 3 years ago

I'm using this: [INFO] JSweet transpiler version 3.0.0 (build date: 2020-12-16 07:35:57) [INFO] dependencies=[Dependency {groupId=org.jsweet, artifactId=jsweet-core, version=6.3.0, type=jar}, Dependency {groupId=org.jsweet.candies, artifactId=jquery, version=1.10.0-20170726, type=jar}] [INFO] candies detection: add project dependency Dependency {groupId=org.jsweet, artifactId=jsweet-core, version=6.3.0, type=jar} => org.jsweet:jsweet-core:jar:6.3.0:compile [INFO] candies detection: add project dependency Dependency {groupId=org.jsweet.candies, artifactId=jquery, version=1.10.0-20170726, type=jar} => org.jsweet.candies:jquery:jar:1.10.0-20170726:compile

This is what I get by building a fresh git checkout of quickstart

lgrignon commented 3 years ago

What's your error please? As you can see, the build is passing on GitHub: https://github.com/cincheo/jsweet-quickstart

lgrignon commented 3 years ago

My bad, I didn't notice that you modified the quickstart code.

There is a discrepancy between Document.getElementsByTagName and Element.getElementsByTagName

https://github.com/cincheo/jsweet/blob/develop/core-lib/es6/src/main/java/def/dom/Element.java#L53 https://github.com/cincheo/jsweet/blob/develop/core-lib/es6/src/main/java/def/dom/Document.java#L675

If you want to fix Element's version. You can file a PR, I will merge it ASAP and deploy

Same for https://github.com/cincheo/jsweet/issues/693 if you feel like it :)