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

Loosen _attachDom return signature. #5666

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Change Log

## [UNRELEASED]() ()
- Loosen _attachDom return signature. ([commit]())

## [v3.4.1](https://github.com/Polymer/polymer/tree/v3.4.1) (2020-04-29)
- [ci skip] bump to 3.4.1 ([commit](https://github.com/Polymer/polymer/commit/12fa1b50))

Expand Down
2 changes: 1 addition & 1 deletion lib/mixins/element-mixin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ interface ElementMixin extends PropertyEffects, TemplateStamp, PropertyAccessors
* @param dom to attach to the element.
* @returns node to which the dom has been attached.
*/
_attachDom(dom: StampedTemplate|null): ShadowRoot|null;
_attachDom(dom: StampedTemplate|null): Node|null;

/**
* When using the ShadyCSS scoping and custom property shim, causes all
Expand Down
2 changes: 1 addition & 1 deletion lib/mixins/element-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ export const ElementMixin = dedupingMixin(base => {
* @throws {Error}
* @suppress {missingReturn}
* @param {StampedTemplate} dom to attach to the element.
* @return {ShadowRoot} node to which the dom has been attached.
* @return {Node} node to which the dom has been attached.
*/
_attachDom(dom) {
const n = wrap(this);
Expand Down
2 changes: 1 addition & 1 deletion test/unit/mixin-utils.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@
});
</script>
</body>
</html>
</html>
6 changes: 6 additions & 0 deletions test/unit/polymer.element.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@
this._calledReady++;
}

_attachDom(dom) {
this.appendChild(dom);
return this;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this change necessary, or is it demonstrating usage?

With this change, the test element doesn't have a shadow root I think. Could we assert for that in this test?

Copy link
Author

Choose a reason for hiding this comment

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

Not necessary. In the Contributor docs, it says every change has to be accompanied by some change in tests.

I'll try adding an assert.


_compute(value) {
return value;
}
Expand Down Expand Up @@ -401,6 +406,7 @@ <h1>Sub template</h1>
assert.equal(el.prop, 'base');
assert.equal(el.computedPropDep, true);
assert.equal(el.computedProp, true);
assert.isNull(el.shadowRoot);
});

test('attributes', function() {
Expand Down