| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| Parent folder | |||
| README.md | 2026-09-28 | 5.2 kB | |
| v2.2.0 source code.tar.gz | 2026-09-28 | 116.1 kB | |
| v2.2.0 source code.zip | 2026-09-28 | 134.1 kB | |
| Totals: 3 Items | 255.3 kB | 0 | |
Minor Changes
- #404
defdd9eThanks @matthewhudson! - Add ChromeOS and Linux detection viadevice.chromeos()anddevice.linux(). ChromeOS and desktop Linux browsers now get thechromeos desktop/linux desktopCSS classes on<html>(previously justdesktop), anddevice.osreports'chromeos'/'linux'instead of'unknown'. Android, HarmonyOS and smart TVs, which also report "Linux" in their user agent, are unchanged. TheDeviceOstype gains'chromeos'and'linux'.
Patch Changes
-
#414
f0091b2Thanks @matthewhudson! - Fix three false positives in Apple device detection: -
iPads whose user agent says
iPad; CPU iPhone OS(seen on iPad mini) were detected as both iPhone and iPad, and reportedtype: 'mobile'withios ipad tabletclasses.device.iphone()anddevice.mobile()now return false for them anddevice.typeis'tablet'. - Android devices with "mac" in their user agent, such as a model named "Mac Audio", were given the
macos desktopclasses anddevice.macos()returned true.device.macos()is now false on Android. -
The iPadOS 13+ check (
navigator.platformisMacInteland the device has a touchscreen) ignored the user agent, so a Windows or Android user agent in such an environment was detected as an iPad. It now also requires a Mac user agent. -
#412
e9f780eThanks @matthewhudson! - Fix the<html>class handling when the page has its own classes that contain a class name current-device uses. Classes were matched as substrings, so with<html class="landscape-hero">thelandscapeclass was never added, and with<html class="theme portrait-gallery">removingportraitrewrote the page's class totheme-gallery. An orientation class that was the first class on<html>was also never removed. Classes are now added and removed withclassList. -
#411
952baa4Thanks @matthewhudson! - Fix three detection bugs found with real-world user agent strings: -
Windows Phone 8.1 (IE Mobile 11) was detected as macOS, because its UA contains "Mac OS X". It now reports
os: 'windows'withwindows mobileclasses, andmacos()andfxos()return false. - Samsung Tizen smart TVs were detected as Linux, because their UA says
SMART-TV(with a hyphen). They now reportos: 'television'with thetelevisionclass. -
BlackBerry PlayBook was not detected, because its UA says "RIM Tablet OS" instead of BlackBerry. It now reports
os: 'blackberry',type: 'tablet'withblackberry tabletclasses. -
#402
45809bbThanks @matthewhudson! - Fix orientation detection in Safari on iOS 16.4+.device.landscape(),device.portrait(), thelandscape/portraitCSS classes andonChangeOrientationcallbacks reported the previous orientation after a rotation, because iOS updatesscreen.orientationonly after theorientationchangeevent fires. iOS now useswindow.orientation, which is updated in time. Fixes [#367]. -
#413
ba29fc5Thanks @matthewhudson! - Fixdevice.onChangeOrientation()callbacks being called when the orientation did not change. On browsers without theorientationchangeevent (all desktop browsers) current-device listens toresize, and it called every callback and rewrote the<html>classes on each resize event, so dragging a window edge called them continuously. Callbacks are now called, and thelandscape/portraitclasses updated, only when the orientation changes. -
#415
e363ec5Thanks @matthewhudson! - Fix the orientation of a square viewport. When the viewport's width and height were equal,<html>got theportraitclass, butdevice.portrait()anddevice.landscape()both returned false anddevice.orientationwas'unknown'. A square viewport is now portrait everywhere, which matches the CSS(orientation: portrait)media query.