Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing whole Custom Elements API #351

Closed
scalway opened this issue Mar 27, 2019 · 7 comments
Closed

missing whole Custom Elements API #351

scalway opened this issue Mar 27, 2019 · 7 comments

Comments

@scalway
Copy link

scalway commented Mar 27, 2019

missing classes in

org.scalajs.dom.raw:

in Element:

/** Creates a shadow root for element and returns it. */
def attachShadow(init:js.Any):ShadowRoot

in Window:

def customElements:CustomElementRegistry

new interface that HTMLElement should extends

interface Slotable {
    readonly assignedSlot: HTMLSlotElement | null;
}

caniuse of ShadowDom

Should I send PR or we are not interested this API until it is covered by all browsers?

@sjrd
Copy link
Member

sjrd commented Mar 27, 2019

In general, we accept PRs for APIs that are specified in the DOM standard, unless there is some evidence that it won't be implemented in all browsers. If it's not yet implemented in all browsers, but it's standardized, that's fine.

@mseddon
Copy link
Contributor

mseddon commented Mar 31, 2019

That would usually live in the org.scalajs.dom.experimental sub package. The point being anything imported from org.scalajs.dom should always work across all supported browsers to minimise confusion, but partially adopted APIs are always encouraged in the library there. The general approach is to have an import that enriches the relevant type via implicits.

@scalway
Copy link
Author

scalway commented Apr 11, 2019

I leave it 4 now. Scalajs 0.6 does not compile ES2015 with Google Closure Compiler. It means we are not ready to write WebComponents using 0.6 tree yet. It could be useful for scalajs 1.0 (where fullOpt'll produce minified version) but not there yet. I have some code of it in my internal project but it needs to be polished

I'll continue my experiments with WebComponents when 1.0 version will be in RC state. Hopefully browser support'll increase up to then.

@mseddon
Copy link
Contributor

mseddon commented Oct 25, 2019

@sjrd I have been on a rather long hiatus from Scala so my information is embarrassingly out of date, sorry! :)

The issue with providing WebComponents 1.0 here is that it will require ES6 class syntax to even function, since it requires extending HTMLComponent using modern class syntax. Does Scala.js produce ES6 or above out of the box now, and if we optionally provide ES5 fallbacks, how should we expose it without breaking ECMA5 users? (I suspect it will probably just 'not work' without choking Scala.js builds, but it would be nice to alert the user that it's futile trying at compile time). I am fairly sure we have moved passed 0.6 though...

@sjrd
Copy link
Member

sjrd commented Oct 25, 2019

Scala.js 0.6.x has provided an option to emit ECMAScript 2015 (ES 6) for years:

scalaJSLinkerConfig ~= { _.withESFeatures(_.withUseECMAScript2015(true)) }

Scala.js 1.0.0-M7 and above emit ECMAScript 2015 by default, and the same option with false can be used to force it to emit ES 5.1.

@armanbilge
Copy link
Member

@scalway at a quick glance it seems some of these APIs are more widely supported now, if you're still up for it we can consider a PR for the experimental package.

@armanbilge
Copy link
Member

Marking as duplicate of #191.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants