Handle the case when the CSS parsing fails
This commit is contained in:
@@ -70,6 +70,10 @@ app.controller('ResultsCtrl', function ($scope) {
|
||||
});
|
||||
}
|
||||
|
||||
// Check if the CSS was correctly parsed
|
||||
$scope.cssParsingError = (!$scope.phantomasResults.metrics.cssRules && $scope.phantomasResults.metrics.cssCount > 0);
|
||||
|
||||
// Grab the notes
|
||||
$scope.notations = {
|
||||
domComplexity: getDomComplexityScore(),
|
||||
domManipulations: getDomManipulationsScore(),
|
||||
@@ -300,7 +304,9 @@ app.controller('ResultsCtrl', function ($scope) {
|
||||
}
|
||||
|
||||
function getCSSComplexityScore() {
|
||||
if (!$scope.phantomasResults.metrics.cssRules) {
|
||||
if ($scope.cssParsingError) {
|
||||
return 'F';
|
||||
} else if (!$scope.phantomasResults.metrics.cssRules) {
|
||||
return 'NA';
|
||||
}
|
||||
|
||||
@@ -326,7 +332,9 @@ app.controller('ResultsCtrl', function ($scope) {
|
||||
}
|
||||
|
||||
function getBadCssScore() {
|
||||
if (!$scope.phantomasResults.metrics.cssRules) {
|
||||
if ($scope.cssParsingError) {
|
||||
return 'F';
|
||||
} else if (!$scope.phantomasResults.metrics.cssRules) {
|
||||
return 'NA';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user