Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@fregante
Copy link
Contributor

@fregante fregante commented Jan 5, 2017

This should now be supported:

balanceText(document.body.children); // HTMLCollection
balanceText(jQuery('.balanceme')); // Array-like

and previously-supported NodeLists and selectors should be slightly faster because I'm skipping the Array.prototype.slice call for all.

Replaces/includes #95 and #96

@fregante
Copy link
Contributor Author

fregante commented Jan 5, 2017

I'm gonna make a few more small changes

@BrianGenisio
Copy link
Contributor

Lots of good cleanups in here. I think there is room for a lot more, but to avoid too much of a diff, I think they are warranted in a separate PR.

I'm curious what bugs you were running in to regarding array-likes. I had tested jQuery lists and node lists by hand. I'm glad you codified it, though, in the interface.htm file.

Thanks for these clean-ups :)

@fregante
Copy link
Contributor Author

fregante commented Jan 5, 2017

In that "bugs" commit, respectively:

  • typo
  • [el,el].concat(nodelist) is [el,el,nodelist] rather than [el,el,el,el], so concat needs to be applied
  • elements at that point might also be a single element

@redmunds
Copy link
Contributor

redmunds commented Jan 5, 2017

This looks good to me. I tested on Mac10.10/Chrome, Mac10.10/Safari, Win10/Firefox, and Win10/Edge.

@bfred-it @BrianGenisio Any last changes you want to get in before I merge?

@BrianGenisio
Copy link
Contributor

LGTM!!!!

@redmunds redmunds changed the title Accepts all kinds of Array-like objects Remove jQuery Dependency Jan 5, 2017
@redmunds redmunds changed the title Remove jQuery Dependency Accepts all kinds of Array-like objects Jan 5, 2017
@redmunds redmunds merged commit bb9fd69 into adobe:master Jan 6, 2017
@redmunds
Copy link
Contributor

redmunds commented Jan 6, 2017

@BrianGenisio @bfred-it @Rycochet Thanks for your contributions. This is awesome!

@fregante fregante deleted the Khan/native branch January 6, 2017 23:33
@fregante
Copy link
Contributor Author

fregante commented Jan 6, 2017

Excellent! I'll publish to npm this weekend. Remind me if I forget 😂

@fregante
Copy link
Contributor Author

fregante commented Jan 7, 2017

v3 published

Thanks a lot for this, @BrianGenisio!

BrianGenisio pushed a commit to Khan/balance-text that referenced this pull request Jan 7, 2017
Accepts all kinds of Array-like objects
@BrianGenisio
Copy link
Contributor

Thanks @bfred-it!!!! So exciting!!! I just published the react-balance-text component using it and it will be going into prod on our site next week.

Also, thanks to @redmunds for this very helpful utility AND for being patient with me on this re-write :)

redmunds added a commit that referenced this pull request Jan 9, 2017
Accepts all kinds of Array-like objects
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

Successfully merging this pull request may close these issues.

5 participants