mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
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:
parent
337c0124d7
commit
72064bd647
@ -6,17 +6,17 @@
|
|||||||
* A hamburger menu element.
|
* A hamburger menu element.
|
||||||
*/
|
*/
|
||||||
class HamburgerElement extends HTMLElement {
|
class HamburgerElement extends HTMLElement {
|
||||||
connectedCallback() {
|
attachedCallback() {
|
||||||
this.innerHTML = '☰'; // Unicode character for hamburger menu.
|
this.innerHTML = '☰'; // 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.
|
* A heading for the page with a hamburger menu and a title.
|
||||||
*/
|
*/
|
||||||
export class HeadingElement extends HTMLElement {
|
export class HeadingElement extends HTMLElement {
|
||||||
connectedCallback() {
|
attachedCallback() {
|
||||||
this.style.display = 'block';
|
this.style.display = 'block';
|
||||||
this.style.backgroundColor = '#2196F3';
|
this.style.backgroundColor = '#2196F3';
|
||||||
this.style.webkitUserSelect = 'none';
|
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.
|
* Reset body's margin and padding, and set font.
|
||||||
@ -46,5 +45,5 @@ function clearStyle() {
|
|||||||
export function main() {
|
export function main() {
|
||||||
document.title = 'Go Heap Viewer';
|
document.title = 'Go Heap Viewer';
|
||||||
clearStyle();
|
clearStyle();
|
||||||
document.body.appendChild(new HeadingElement());
|
document.body.appendChild(document.createElement("heap-heading"));
|
||||||
}
|
}
|
||||||
|
1600
third_party/webcomponents/customelements.js
vendored
1600
third_party/webcomponents/customelements.js
vendored
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user