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

Implement more of the jQuery API #21

Closed
3 of 35 tasks
ragnarlonn opened this issue Dec 22, 2016 · 21 comments
Closed
3 of 35 tasks

Implement more of the jQuery API #21

ragnarlonn opened this issue Dec 22, 2016 · 21 comments

Comments

@ragnarlonn
Copy link

ragnarlonn commented Dec 22, 2016

Manipulation API

  • attr() [readonly]
  • html() [readonly]
  • prop() [readonly]
  • text() [readonly]
  • val() [readonly]

Traversal API

  • add()
  • children()
  • closest()
  • contents()
  • each()
  • end()
  • eq()
  • filter()
  • find()
  • first()
  • has()
  • is()
  • last()
  • map()
  • next()
  • nextAll()
  • nextUntil()
  • not()
  • parent()
  • parents()
  • parentsUntil()
  • prev()
  • prevAll()
  • prevUntil()
  • siblings()
  • slice()

Misc API

  • get()
  • toArray()
  • index()
  • data() [readonly]

Imported from https://trello.com/c/1XvRjs9A/89-implement-more-of-the-jquery-api

@ragnarlonn
Copy link
Author

Emily Ekberg
If someone else wanted to do this, I wouldn't mind pointing out how to, it's mostly a whole lot of writing bridge code. The time-consuming part is writing unit tests for every call.
Nov 2 at 2:45 PM - Reply - Delete

@liclac
Copy link
Contributor

liclac commented Jan 13, 2017

Fairly low-hanging fruit if someone else wants to take this. Just look at the existing bridges and add more like them.

@ppcano
Copy link
Contributor

ppcano commented Mar 16, 2017

@uppfinnarn Help wanted label?

@liclac
Copy link
Contributor

liclac commented Mar 16, 2017

@ppcano Yes, please. Though it'll have to wait until the new JS runner is merged, which will make this all even easier to do.

@micsjo
Copy link
Contributor

micsjo commented Mar 16, 2017

val() is not implemented in goquery. attr() is as well as attrOr(). I suggest implementing at least attr().

micsjo added a commit to micsjo/k6 that referenced this issue Mar 20, 2017
Implement attr() grafana#21

NO tests included since the new JS implementation will lead to refactoring this implementation. The attr() implementation is needed to implement the sample scripts.
@denim2x
Copy link

denim2x commented Apr 21, 2017

@ragnarlonn I'd like to finish this task; is the bounty still available ?

@robingustafsson
Copy link
Member

@denim2x Yes, the bounty is still available. No one else has started working on this issue afaik, so go for it!

@robingustafsson
Copy link
Member

robingustafsson commented Apr 21, 2017

@denim2x To clarify, this issue should be implemented in terms of the js2 runner (https://github.com/loadimpact/k6/tree/master/js2). So extending what's in https://github.com/loadimpact/k6/blob/master/js2/modules/k6/html/html.go more or less.

Edit: and running k6 with the js2 runner is done by executing k6 run -t js2 my_script.js

@denim2x
Copy link

denim2x commented Apr 22, 2017

@robingustafsson Thanks

@denim2x
Copy link

denim2x commented Apr 27, 2017

@robingustafsson question: What is the expected behavior of prop():

  • hash map storage
  • empty string
  • nil
  • other?

@liclac
Copy link
Contributor

liclac commented Apr 27, 2017

Could you elaborate?

@denim2x
Copy link

denim2x commented Apr 27, 2017

prop(name) is supposed to return the property name and there's no implementation in goquery for this - so how should it behave?

@liclac
Copy link
Contributor

liclac commented Apr 27, 2017

Ah, I see. Just leave it out then - I believe the attr()/prop() split was in a more recent jQuery version.

@denim2x
Copy link

denim2x commented Apr 27, 2017

  • do methods like children have to support filtering?
  • if so - are Matchers also required?

@liclac
Copy link
Contributor

liclac commented Apr 27, 2017

I'd say yes, we want to get as close to the original jQuery API as possible; goja.AssertFunction is your friend, that gives you a function you can call as fn(this goja.Value, args ...goja.Value) goja.Value.

@ragnarlonn
Copy link
Author

@denim2x Hi Cristian, are you making any progress? Is anything still unclear?

@catesq
Copy link
Contributor

catesq commented May 4, 2017

Hello. On bountysource they changed status to stopped working on it so it seemed like it'd be ok for me to step in...

I've made a fork and a start in feature/jquery branch. Have only added Html() and a basic implementation of Val() so far.

Would you like a PR with what I've got now?

@ragnarlonn
Copy link
Author

@mitnuh Yeah, I think a PR is probably good. If @liclac can take a look at it now and give feedback it might save you some time spent changing things later.

liclac added a commit that referenced this issue Oct 26, 2017
Feature/jquery Extend jquery api for #21
@catesq
Copy link
Contributor

catesq commented Nov 2, 2017

Hi. Sorry to bother you but is it ok to close this issue? The PR has been merged but the bounty can't be claimed until the related issue is closed. Thank you.

@robingustafsson
Copy link
Member

@mitnuh Yes, I'll close the issue. Thank you for your hard work!

@catesq
Copy link
Contributor

catesq commented Nov 2, 2017

Thank you!

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

7 participants