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

fix webcomponent example issue #7056 #7057

Merged
merged 2 commits into from
Jun 22, 2016
Merged
Changes from 1 commit
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
12 changes: 12 additions & 0 deletions examples/webcomponents/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ <h4>Example Details</h4>
// Define WebComponent
var proto = Object.create(HTMLElement.prototype, {
createdCallback: {
value: function() {
}
}
,attachedCallback: {
value: function() {
var mountPoint = document.createElement('span');
this.createShadowRoot().appendChild(mountPoint);
Expand All @@ -47,6 +51,14 @@ <h4>Example Details</h4>
ReactDOM.render(<a href={url}>{name}</a>, mountPoint);
}
}
,detachedCallback: {
value: function() {
}
}
,attributeChangedCallback: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Afaik, we don't need to define createdCallback, detachedCallback, nor attributeChangedCallback. It just makes the example more complicated and detracts from what we're demonstrating. Can you remove these additional functions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are correct, they are not required for the purposes of the demonstration, though it is quite nice to have all four callbacks available should someone want to know which ones exist or want to expand upon the example. Also, I didn't see it as complicating the example since they are empty functions but to your point, less code to read is less. I will remove them.

value: function() {
}
}
});
document.registerElement('x-search', {prototype: proto});

Expand Down