2020-01-02 15:13:47 -05:00
|
|
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
2020-04-11 11:42:02 -04:00
|
|
|
|
|
|
|
import * as domTypes from "./dom_types.d.ts";
|
2019-05-27 09:20:34 -04:00
|
|
|
|
2020-03-28 13:03:49 -04:00
|
|
|
export function getDOMStringList(arr: string[]): domTypes.DOMStringList {
|
|
|
|
Object.defineProperties(arr, {
|
|
|
|
contains: {
|
|
|
|
value(searchElement: string): boolean {
|
|
|
|
return arr.includes(searchElement);
|
|
|
|
},
|
|
|
|
enumerable: true,
|
|
|
|
},
|
|
|
|
item: {
|
|
|
|
value(idx: number): string | null {
|
|
|
|
return idx in arr ? arr[idx] : null;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
2020-04-11 11:42:02 -04:00
|
|
|
return arr as string[] & domTypes.DOMStringList;
|
2019-05-27 09:20:34 -04:00
|
|
|
}
|