Skip to content

Instantly share code, notes, and snippets.

@esmasui
Created August 8, 2013 05:48
Show Gist options
  • Select an option

  • Save esmasui/6181811 to your computer and use it in GitHub Desktop.

Select an option

Save esmasui/6181811 to your computer and use it in GitHub Desktop.
enchantMOON window.nsオブジェクトのダンプ
validate=function (ns,URI){if(!ns){throw new core.DOMException(core.INVALID_CHARACTER_ERR,"namespace is undefined")}if(ns.match(/[^0-9a-z\.:\-_]/i)!==null){throw new core.DOMException(core.INVALID_CHARACTER_ERR,ns)}var msg=false,parts=ns.split(":");if(ns==="xmlns"&&URI!=="http://www.w3.org/2000/xmlns/"){msg="localName is 'xmlns' but the namespaceURI is invalid"}else if(ns==="xml"&&URI!=="http://www.w3.org/XML/1998/namespace"){msg="localName is 'xml' but the namespaceURI is invalid"}else if(ns[ns.length-1]===":"){msg="Namespace seperator found with no localName"}else if(ns[0]===":"){msg="Namespace seperator found, without a prefix"}else if(parts.length>2){msg="Too many namespace seperators"}if(msg){throw new core.DOMException(NAMESPACE_ERR,msg+" ("+ns+"@"+URI+")")}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment