instanceof instead of nodeType
This commit is contained in:
parent
cd469f33db
commit
e89970d339
1 changed files with 5 additions and 7 deletions
|
@ -146,10 +146,9 @@ function sortFilters(cmp: (a: Node, b: Node) => number) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function sortFiltersAlpha(e: Event) {
|
function sortFiltersAlpha(e: Event) {
|
||||||
function getName(node: Node) {
|
function getName(node: Node): string {
|
||||||
if (node.nodeType == Node.ELEMENT_NODE) {
|
if (node instanceof Element) {
|
||||||
let elt = node as Element;
|
return node.getElementsByTagName('input')[0].value;
|
||||||
return elt.getElementsByTagName('input')[0].value;
|
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
@ -160,9 +159,8 @@ function sortFiltersAlpha(e: Event) {
|
||||||
|
|
||||||
function sortFiltersUses(e: Event) {
|
function sortFiltersUses(e: Event) {
|
||||||
function getUses(node: Node) {
|
function getUses(node: Node) {
|
||||||
if (node.nodeType == Node.ELEMENT_NODE) {
|
if (node instanceof Element) {
|
||||||
let elt = node as Element;
|
const countStr = node.getElementsByTagName('label')[0].dataset.count;
|
||||||
let countStr = elt.getElementsByTagName('label')[0].dataset.count;
|
|
||||||
return countStr ? +countStr : 0;
|
return countStr ? +countStr : 0;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue