Comments (4)
Note that this is a one line change in each of https://github.com/lihaoyi/scalatags/blob/master/scalatags/js/src/main/scala/scalatags/JsDom.scala#L43 and https://github.com/lihaoyi/scalatags/blob/master/scalatags/shared/src/main/scala/scalatags/Text.scala#L38. I'll be happy to make the pull request adding with jsdom.Tags
to object short
. I just wanted to make sure we agree this is a bug.
To explain a bit more clearly why I think this is appropriate:
This compiles:
import scalatags.JsDom.all._
div(width:=10.px, List(p,p))
But you might not want all the styles and attributes polluting your namespaces, so short
is provided. The div above would become div(*.width:=10.px, List(p,p))
. However, contrary to the docs, this doesn't compile:
import scalatags.JsDom.short._
div(*.width:=10.px, List(p,p))
You could add import scalatags.JsDom.tags._
, and it will still fail to compile.
It will compile if you import short.*; all._
, or short._; tags.{p,div}
but those are undesirable for obvious reasons. So you might decide to try:
scalatags.JsDom.short.*
scalatags.JsDom.tags._
div(*.width:=10.px, List(p,p))
That compiles - yay! But other things will break unless you also import:
import scalatags.JsDom.short.{bindJsAny,bindJsAnyLike,bindNode}
import scalatags.JsDom.implicits._
import scalatags.DataConverters._
and probably a bunch of other things that I'm missing and aren't meant to be part of the public API.
Same is true if you replace all occurences of JsDom
with Text
. In the case where you try to import text._
with short._
, compile errors won't show up in the REPL unless you wrap all of those lines in an object{...}
.
TL;DR
As per the docs, I want to write div(*.width:=10.px, List(p,p))
and can't without hideous imports. It's a two-line fix if we agree it's a bug.
from scalatags.
So, after a bit more digging, I've found a bug in the tests for manual Imports. which is that import bundle.all._
is in scope, which kinda defeats the point of manual imports. I'll tweak the tests and offer a PR.
from scalatags.
Thanks for digging into this @stewSquared!!!
from scalatags.
Your fix has been merged
from scalatags.
Related Issues (20)
- Allow traversal of constructed Tag tree HOT 1
- Scalatags is Not Found HOT 2
- SeqFrag not working when svgAttrs / svgTags are imported
- Unresolved dependency HOT 2
- Empty class throws Uncaught DOMException HOT 1
- Link to scala tags documentation site seems to be down? HOT 1
- Example doesn't work in Scala 3 with latest versions and sbt HOT 4
- Access modifiers in Scala 3
- Add `sizes` attribute HOT 1
- Scalatags only supports immutable Seq? HOT 1
- How to select tags in a stylesheet HOT 1
- Model traversal HOT 1
- Release for Scala 3 + Native :) HOT 1
- Any reason to still allow unit fragments in scala 3? HOT 1
- Usage question: How to use svg HOT 1
- Unable to get the value of `styleSheetText` in Scala 3 HOT 1
- Dependency on com.lihaoyi:geny version 0.2.0 instead of 1.0.0 HOT 1
- Where to ask questions about functionality? HOT 1
- Docs don't build
- Escaping.validAttrName disallows a leading understore
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scalatags.