Comments (13)
As far as I'm aware Raphael doesn't support classes at all natively; would the solution be to drill through to the elem.node?
PS the documentation currently uses .attr('class','point') despite it not working.
from d34raphael.
Never mind, the issue is that the .attr({ ... }) syntax doesn't support class.
from d34raphael.
Downside of this split repository approach is that I can't directly attach a pull request to this issue. See here instead:
webmonarch/d3#1
from d34raphael.
@clint-tseng Thanks. I've updated the issue description to more clearly explain my intent.
RE: the selection.attr({attrName: attrVal})
syntax: right now, d34r selection.attr call follows the API set by d3. The .attr({name: val, name: val}) syntax is part of Raphael Element.attr call.
Let me know if I miss-understood. I will take a look at the pull-request.
from d34raphael.
RE: the {} syntax, I think it's important to be consistent, so the API should either accept { class: '...' }, or we should make .attr('class', '...') throw not supported and force people to use .classed(...) instead. I think aesthetically the latter mirrors Raphael better, but the former certainly eases transitional issues from standard D3.
from d34raphael.
@clint-tseng I expect selection.attr("class", "classname") to work on d34r. It's used in all the examples.
from d34raphael.
Yes, and it does. But, selection.attr({ class: 'className' }) does not. The inconsistency there is somewhat confusing in my mind.
from d34raphael.
I agree with webmonarch. You can't use class because it's a reserved word and the browser will tell you so, it's not an inconsistency.
from d34raphael.
But that's not why it doesn't work, right? I could easily (and I do) use { 'class': 'className' }. It works in D3. I think it's confusing that it doesn't work in D34r. I'm not trying to make any religious argument here, I'm just trying to point out an inconsistency in the API that cost me a couple of hours.
from d34raphael.
It is not an inconsistency with the API, it is a consistency with JavaScript. class is not the same as "class". For this same reason class name properties are assigned to elements via className instead of class. class is a reserved word.
from d34raphael.
Hrm. I see what you're saying. On the other hand, I could swear that last week I was using { 'class': 'className' } in raw d3 and it was working fine. If it's well-known that one should use { className: 'className' } then I defer to that.
I still think it's odd that we allow .attr('class', 'className') if the .attr({'class', 'className'}) version isn't supported, though.
from d34raphael.
className is not a raphael or D3 convention, its what the DOM uses to assign class names to elements.
As far as .attr('class', 'className') goes, the goal of d34raphael is to make an IE compatible version of D3 that resembles the original D3 as close as possible. The fact that Raphael is used as a compatibility layer for a SVG fallback should be exposed as little as possible.
from d34raphael.
Resolved between webmonarch/d3#1 and webmonarch/d3@c6ac75c
from d34raphael.
Related Issues (20)
- Document d34raphael APIs HOT 1
- Reuse jQuery Sizzle if Present HOT 2
- Add support group element. HOT 3
- Appended entered nodes not added to update selection. HOT 6
- mouse-events possible? HOT 3
- Raphael.js as an overlay on d3.js HOT 1
- IE 8 in Wine HOT 2
- Add support for tickFormat to D3RaphaelAxis HOT 1
- Support for .on("mouseover", function() { d3.select(this).attr("stroke", "#fff");})
- how to use selectAll(".year_button") .data([minYearFilter, maxYearFilter+1]) using r3d3
- Unable to give Id to an element. i am creating a x axis and appending a rectangle on it but it's not giving id to it. i also need to append button to create slider but without id its not possible. HOT 1
- Perfomance Issue using selectAll in ie8 and ie9
- d34raphael needs a new caretaker HOT 1
- Complete `d3.raphael.axis` Implementation HOT 1
- Package d34r as a JS library for use WITH d3.v2.js HOT 1
- Style JSDoc pages
- Add d3 <-> raphael Event Support HOT 2
- Add d3 <-> raphael Transition Support HOT 2
- Create as Standalone Plugin HOT 1
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 d34raphael.