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

Insert methods should return new node #193

Closed
ai opened this issue Feb 11, 2015 · 6 comments
Closed

Insert methods should return new node #193

ai opened this issue Feb 11, 2015 · 6 comments

Comments

@ai
Copy link
Member

ai commented Feb 11, 2015

It is important to use shortcuts API:

var rule = root.append({ selector: 'a' });
rule.append({ prop: 'color', value: 'black' })
@ai ai added 5.0 labels Feb 11, 2015
@ai ai mentioned this issue Feb 11, 2015
11 tasks
@MoOx
Copy link
Contributor

MoOx commented Feb 13, 2015

What if you append more than one node (I think we can, right)?
This will make the return of the function not really predictable.
Or it should always return a node list ? Or append should only accept one node ? (or we should get appendNode and appendNodes method ?

@ai
Copy link
Member Author

ai commented Feb 13, 2015

Hm. Good questions. Maybe we should allow to send only node, not a array. What is a user case to send a array?

@MoOx
Copy link
Contributor

MoOx commented Feb 13, 2015

Don't know, just askin question. append is just not verbose enough for me. Not clear enough.
I don't like jQuery like API that allows ton of different behavior from a single method :/

@MoOx
Copy link
Contributor

MoOx commented Feb 13, 2015

If .append() only accept a node, so forget what I said on this thread :)

@ai
Copy link
Member Author

ai commented Feb 13, 2015

@MoOx +1 about jQuery methods :).

I added append(array) behaviour for CSS concat tools:

root1.append(root2.nodes)

But it is a rare case, instead of

var rule = atrule.append({ selector: 'a' });
rule.append({ prop: 'color', value: 'black' });

So we can just remove array support from insert methods,

@MoOx
Copy link
Contributor

MoOx commented Feb 13, 2015

Why not. And with es6 arrow func, will be short to replace appended array :)

@ai ai modified the milestone: 6.0 Feb 22, 2016
@ai ai removed the 6.0 label Feb 22, 2016
@ai ai closed this as completed Apr 14, 2017
@ai ai removed this from the 6.0 milestone May 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants