mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-09-27 07:58:45 +03:00
Move feature detection to its own dedicated method
This commit is contained in:
parent
4711805a1c
commit
b385a73340
@ -964,14 +964,7 @@
|
|||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
UAParserItem.prototype.get = function (prop) {
|
UAParserItem.prototype.detectFeature = function () {
|
||||||
if (!prop) return this.data;
|
|
||||||
return this.data.hasOwnProperty(prop) ? this.data[prop] : undefined;
|
|
||||||
};
|
|
||||||
UAParserItem.prototype.parseUA = function () {
|
|
||||||
if (this.itemType != UA_RESULT) {
|
|
||||||
rgxMapper.call(this.data, this.ua, this.rgxMap);
|
|
||||||
}
|
|
||||||
var isSelfNav = NAVIGATOR && NAVIGATOR.userAgent == this.ua;
|
var isSelfNav = NAVIGATOR && NAVIGATOR.userAgent == this.ua;
|
||||||
switch(this.itemType) {
|
switch(this.itemType) {
|
||||||
case UA_BROWSER:
|
case UA_BROWSER:
|
||||||
@ -998,6 +991,17 @@
|
|||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
UAParserItem.prototype.get = function (prop) {
|
||||||
|
if (!prop) return this.data;
|
||||||
|
return this.data.hasOwnProperty(prop) ? this.data[prop] : undefined;
|
||||||
|
};
|
||||||
|
UAParserItem.prototype.parseUA = function () {
|
||||||
|
if (this.itemType != UA_RESULT) {
|
||||||
|
rgxMapper.call(this.data, this.ua, this.rgxMap);
|
||||||
|
}
|
||||||
|
this.detectFeature();
|
||||||
|
return this;
|
||||||
|
};
|
||||||
UAParserItem.prototype.parseCH = function () {
|
UAParserItem.prototype.parseCH = function () {
|
||||||
var ua = this.ua,
|
var ua = this.ua,
|
||||||
uaCH = this.uaCH,
|
uaCH = this.uaCH,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user