function Storage() {
	const g_map = new WeakMap();

	/*
	 * Store a value under a key inside an element.
	 */
	this.put = function(elem, key, value) {
		let map = g_map.get(elem);

		/*
		 * Check if element is still unknown.
		 */
		if (map == null) {
			map = new Map();
			g_map.set(elem, map);
		}

		map.set(key, value);
	};

	/*
	 * Fetch a value from a key inside an element.
	 */
	this.get = function(elem, key, value) {
		const map = g_map.get(elem);

		/*
		 * Check if element is unknown.
		 */
		if (map == null) {
			return null;
		} else {
			const value = map.get(key);
			return value;
		}

	};

	/*
	 * Check if a certain key exists inside an element.
	 */
	this.has = function(elem, key) {
		const map = g_map.get(elem);

		/*
		 * Check if element is unknown.
		 */
		if (map == null) {
			return false;
		} else {
			const value = map.has(key);
			return value;
		}

	};

	/*
	 * Remove a certain key from an element.
	 */
	this.remove = function(elem, key) {
		const map = g_map.get(elem);

		/*
		 * Check if element is known.
		 */
		if (map != null) {
			map.delete(key);

			/*
			 * If inner map is now empty, remove it from outer map.
			 */
			if (map.size === 0) {
				g_map.delete(elem);
			}

		}

	};

}
/*
 * A class implementing data storage.
 */
A class implementing data storage.
A class implementing data storage .
function Storage() {
	const g_map = new WeakMap();
	this.put = function(elem, key, value) {
		let map = g_map.get(elem);
		if (map == null) {
			map = new Map();
			g_map.set(elem, map);
		}
		map.set(key, value);
	};
	this.get = function(elem, key, value) {
		const map = g_map.get(elem);
		if (map == null) {
			return null;
		} else {
			const value = map.get(key);
			return value;
		}
	};
	this.has = function(elem, key) {
		const map = g_map.get(elem);
		if (map == null) {
			return false;
		} else {
			const value = map.has(key);
			return value;
		}
	};
	this.remove = function(elem, key) {
		const map = g_map.get(elem);
		if (map != null) {
			map.delete(key);
			if (map.size === 0) {
				g_map.delete(elem);
			}
		}
	};
}
function Storage ( ) { const g_map = new WeakMap ( ) ; this . put = function ( elem , key , value ) { let map = g_map . get ( elem ) ; if ( map == null ) { map = new Map ( ) ; g_map . set ( elem , map ) ; } map . set ( key , value ) ; } ; this . get = function ( elem , key , value ) { const map = g_map . get ( elem ) ; if ( map == null ) { return null ; } else { const value = map . get ( key ) ; return value ; } } ; this . has = function ( elem , key ) { const map = g_map . get ( elem ) ; if ( map == null ) { return false ; } else { const value = map . has ( key ) ; return value ; } } ; this . remove = function ( elem , key ) { const map = g_map . get ( elem ) ; if ( map != null ) { map . delete ( key ) ; if ( map . size === 0 ) { g_map . delete ( elem ) ; } } } ; }
A class implementing data storage.
A class implementing data storage .
/*
	 * Store a value under a key inside an element.
	 */ /*
		 * Check if element is still unknown.
		 */ /*
	 * Fetch a value from a key inside an element.
	 */ /*
		 * Check if element is unknown.
		 */ /*
	 * Check if a certain key exists inside an element.
	 */ /*
		 * Check if element is unknown.
		 */ /*
	 * Remove a certain key from an element.
	 */ /*
		 * Check if element is known.
		 */ /*
			 * If inner map is now empty, remove it from outer map.
			 */