From cf5c1f9e011cf7013133f35bd032dd86f702477d Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sat, 12 Dec 2015 17:34:00 +0700 Subject: [PATCH] Check for tablet first --- src/ua-parser.js | 3 ++- test/device-test.json | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 009bae8..7348fec 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -599,7 +599,8 @@ /android.+(mi[\s\-_]*(?:one|one[\s_]plus)?[\s_]*(?:\d\w)?)\s+build/i // Xiaomi Mi ], [[MODEL, /_/g, ' '], [VENDOR, 'Xiaomi'], [TYPE, MOBILE]], [ - /(mobile|tablet)/i // Unidentifiable + /\s(tablet)[;\/\s]/i, // Unidentifiable Tablet + /\s(mobile)[;\/\s]/i // Unidentifiable Mobile ], [[TYPE, util.lowerize], VENDOR, MODEL] /*////////////////////////// diff --git a/test/device-test.json b/test/device-test.json index 49bbc5c..fa10540 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -258,5 +258,15 @@ "model" : "PlayStation 4", "type" : "console" } + }, + { + "desc" : "Galaxy Nexus", + "ua" : "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19", + "expect" : + { + "vendor" : "Samsung", + "model" : "Galaxy Nexus", + "type" : "mobile" + } } ]