cmd/heapview: dowgrade to customelements v0

I've had too many issues with customelements v1. The interface for v0
isn't as nice, and v0 will eventually be deprecated. But v1's polyfill
library is better supported, and it will be easy to upgrade later.

Change-Id: I87b376376b750167a0464c6c249930edecbd59db
Reviewed-on: https://go-review.googlesource.com/25545
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
This commit is contained in:
Michael Matloob 2016-08-05 16:40:13 -04:00
parent 337c0124d7
commit 72064bd647
2 changed files with 1021 additions and 590 deletions

View File

@ -6,17 +6,17 @@
* A hamburger menu element.
*/
class HamburgerElement extends HTMLElement {
connectedCallback() {
attachedCallback() {
this.innerHTML = '&#9776'; // Unicode character for hamburger menu.
}
}
window.customElements.define('heap-hamburger', HamburgerElement);
document.registerElement('heap-hamburger', HamburgerElement);
/**
* A heading for the page with a hamburger menu and a title.
*/
export class HeadingElement extends HTMLElement {
connectedCallback() {
attachedCallback() {
this.style.display = 'block';
this.style.backgroundColor = '#2196F3';
this.style.webkitUserSelect = 'none';
@ -28,8 +28,7 @@ export class HeadingElement extends HTMLElement {
`;
}
}
window.customElements.define('heap-heading', HeadingElement);
document.registerElement('heap-heading', HeadingElement);
/**
* Reset body's margin and padding, and set font.
@ -46,5 +45,5 @@ function clearStyle() {
export function main() {
document.title = 'Go Heap Viewer';
clearStyle();
document.body.appendChild(new HeadingElement());
document.body.appendChild(document.createElement("heap-heading"));
}

File diff suppressed because it is too large Load Diff