{"ScriptPreparationCode":" \r\n var link = \u0022http://stackoverflow.com/questions/8498592/extract-root-domain-name-from-string\u0022;\r\n var host;\r\n \r\n // parseUri 1.2.2\r\n // (c) Steven Levithan \u003Cstevenlevithan.com\u003E\r\n // MIT License\r\n \r\n function parseUri (str) {\r\n \tvar\to = parseUri.options,\r\n \t\tm = o.parser[o.strictMode ? \u0022strict\u0022 : \u0022loose\u0022].exec(str),\r\n \t\turi = {},\r\n \t\ti = 14;\r\n \r\n \twhile (i--) uri[o.key[i]] = m[i] || \u0022\u0022;\r\n \r\n \turi[o.q.name] = {};\r\n \turi[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {\r\n \t\tif ($1) uri[o.q.name][$1] = $2;\r\n \t});\r\n \r\n \treturn uri;\r\n };\r\n \r\n parseUri.options = {\r\n \tstrictMode: false,\r\n \tkey: [\u0022source\u0022,\u0022protocol\u0022,\u0022authority\u0022,\u0022userInfo\u0022,\u0022user\u0022,\u0022password\u0022,\u0022host\u0022,\u0022port\u0022,\u0022relative\u0022,\u0022path\u0022,\u0022directory\u0022,\u0022file\u0022,\u0022query\u0022,\u0022anchor\u0022],\r\n \tq: {\r\n \t\tname: \u0022queryKey\u0022,\r\n \t\tparser: /(?:^|\u0026)([^\u0026=]*)=?([^\u0026]*)/g\r\n \t},\r\n \tparser: {\r\n \t\tstrict: /^(?:([^:\\/?#]\u002B):)?(?:\\/\\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?))?((((?:[^?#\\/]*\\/)*)([^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,\r\n \t\tloose: /^(?:(?![^:@]\u002B:[^:@\\/]*@)([^:\\/?#.]\u002B):)?(?:\\/\\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]\u002B(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/\r\n \t}\r\n };\r\n \r\n function url_domain(data) {\r\n var a = document.createElement(\u0027a\u0027);\r\n a.href = data;\r\n return a.hostname;\r\n }\r\n \r\n function simple_domain(url)\r\n {\r\n var matches = url.match(/^https?\\:\\/\\/([^\\/?#]\u002B)(?:[\\/?#]|$)/i);\r\n return matches[1];\r\n }\r\n \r\n function url_class_hostname(url)\r\n {\r\n return new URL(url).hostname;\r\n }\r\nvar url2 = new URL(\u0022https://jsperf.com/\u0022);\r\n function url_class_hostname2(url)\r\n {url2.href = url;\r\n return url2.hostname;\r\n }","TestCases":[{"Name":"parseUri","Code":"host = parseUri(link).host;","IsDeferred":false},{"Name":"url_domain","Code":"host = url_domain(link);","IsDeferred":false},{"Name":"simple_domain","Code":"host = simple_domain(link);","IsDeferred":false},{"Name":"url_class_hostname","Code":"var host = url_class_hostname(link);","IsDeferred":false},{"Name":"url_class_hostname2","Code":"var host = url_class_hostname2(link);","IsDeferred":false}]}