Skip to content

Can't use PimpedNodeList on NodeListOf #388

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

Closed
avernet opened this issue Nov 20, 2019 · 3 comments
Closed

Can't use PimpedNodeList on NodeListOf #388

avernet opened this issue Nov 20, 2019 · 3 comments

Comments

@avernet
Copy link

avernet commented Nov 20, 2019

Following the instructions on From ES6 to Scala: Advanced, I do:

val images = dom.document.querySelectorAll("img").asInstanceOf[NodeListOf[HTMLImageElement]]
images.map(_.src)

The second line doesn't compile, and the compiler tells us: value map is not a member of org.scalajs.dom.NodeListOf[org.scalajs.dom.raw.HTMLImageElement]. If I import org.scalajs.dom.ext._, I'd expect my NodeListOf to be "pimped", but apparently PimpedNodeList only applies on NodeList, and not on NodeListOf. You can try this in this scastie.

Am I missing something, or is there something incorrect in the documentation? (Or both!)

@mseddon
Copy link
Contributor

mseddon commented Nov 24, 2019

@sjrd things named PimpedAnything aren't so idiomatic now. Perhaps EnrichedNodeList etc. 🌞

@sjrd
Copy link
Member

sjrd commented Nov 24, 2019

I think the current naming convention is NodeListOps.

@japgolly
Copy link
Contributor

japgolly commented Sep 4, 2021

This was implemented in #458

@japgolly japgolly closed this as completed Sep 4, 2021
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

5 participants