UNPKG

siesta-lite

Version:

Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers

87 lines (79 loc) 3.02 kB
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>The source code</title> <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" /> <script type="text/javascript" src="../resources/prettify/prettify.js"></script> <style type="text/css"> .highlight { display: block; background-color: #ddd; } </style> <script type="text/javascript"> function highlight() { document.getElementById(location.hash.replace(/#/, "")).className = "highlight"; } </script> </head> <body onload="prettyPrint(); highlight();"> <pre class="prettyprint lang-js">/* Siesta 5.6.1 Copyright(c) 2009-2022 Bryntum AB https://bryntum.com/contact https://bryntum.com/products/siesta/license */ Role(&#39;Siesta.Util.Role.CanParseBrowser&#39;, { methods : { parseBrowser : function (uaString) { var browser = &#39;unknown&#39; var version = &#39;&#39; var match if (match = /Edg\/(\d+(\.\d+)*)/i.exec(uaString)) { browser = &quot;Edge Chromium&quot; version = match[ 1 ] } else if (match = /Firefox\/((?:\d+\.?)+)/.exec(uaString)) { browser = &quot;Firefox&quot; version = match[ 1 ] } else if (match = /chrome.+? edge\/(\d+(\.\d+)?)/i.exec(uaString)) { browser = &quot;Edge&quot; version = match[ 1 ] } else if (match = /Chrome\/((?:\d+\.?)+)/.exec(uaString)) { browser = &quot;Chrome&quot; version = match[ 1 ] } else if (match = /MSIE\s*((?:\d+\.?)+)/.exec(uaString)) { browser = &quot;IE&quot; version = match[ 1 ] } else if (uaString.match(/trident/i) &amp;&amp; (match = /rv.(\d\d\.?\d?)/.exec(uaString))) { browser = &quot;IE&quot; version = match[ 1 ] } else if (match = /Apple.*Version\/((?:\d+\.?)+)\s*(?=Safari\/((?:\d+\.?)+))/.exec(uaString)) { browser = &quot;Safari&quot; version = match[ 1 ] + &#39; (&#39; + match[ 2 ] + &#39;)&#39; } else if (match = /PhantomJS\/(\d+\.\d+\.\d+)/.exec(uaString)) { browser = &quot;PhantomJS&quot; version = match[ 1 ] } else if (match = /SlimerJS\/(\d+\.\d+\.\d+)/.exec(uaString)) { browser = &quot;SlimerJS&quot; version = match[ 1 ] } else if (match = /NodeJS\/(.+)/.exec(uaString)) { browser = &quot;NodeJS&quot; version = match[ 1 ] } return { name : browser, version : version } } } }); </pre> </body> </html>