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

Reuse dom.childElements and dom.childNodes #3145

Merged
merged 3 commits into from May 9, 2016

Conversation

muxin
Copy link
Contributor

@muxin muxin commented May 6, 2016

Fixes #3115

  • Reuse dom.childElements in ElementProto.getRealChildren
  • Reuse dom.childNodes in ElementProto.getRealChildNodes

@muxin muxin assigned muxin and mkhatib and unassigned muxin May 6, 2016
@muxin
Copy link
Contributor Author

muxin commented May 6, 2016

@cramforce Could you also have a look?

@muxin
Copy link
Contributor Author

muxin commented May 7, 2016

Anyone know why this is failing?

* These nodes can include Text, Comment and other child nodes.
* @param {!Node} parent
* @param {function(!Node):boolean} callback
* @return {!Array.<!Node>}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@mkhatib
Copy link
Contributor

mkhatib commented May 7, 2016

This looks good thanks! Few comments.

@muxin muxin force-pushed the reuse-childElements-childNodes branch from a4f991c to f384d93 Compare May 9, 2016 05:19
* @return {!Array<!Node>}
*/
export function childNodes(parent, callback) {
const childnodes = [];
Copy link
Contributor

@mkhatib mkhatib May 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: call this children or nodes. childnodes doesn't follow the camel-case style and I understand why you didn't use the camel-case here - function name similarity.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@mkhatib
Copy link
Contributor

mkhatib commented May 9, 2016

One more nit! otherwise LGTM

@@ -143,6 +143,20 @@ describe('DOM', () => {
.to.be.equal(0);
});

it('childNodes should find all matches', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a not-all-positive test as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@dvoytenko
Copy link
Contributor

LGTM from my side.

@mkhatib mkhatib added LGTM and removed NEEDS REVIEW labels May 9, 2016
@mkhatib
Copy link
Contributor

mkhatib commented May 9, 2016

👍 LGTM, please wait for the tests and then merge!

@cramforce
Copy link
Member

@mkhatib @muxin does not have merge powers yet :)

@cramforce cramforce merged commit cd55043 into ampproject:master May 9, 2016
@muxin muxin deleted the reuse-childElements-childNodes branch May 9, 2016 18:05
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.

None yet

5 participants