Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rule to check if the lang attribute is used on html element #45

Merged
merged 1 commit into from
Mar 17, 2017
Merged

Add rule to check if the lang attribute is used on html element #45

merged 1 commit into from
Mar 17, 2017

Conversation

alrra
Copy link
Contributor

@alrra alrra commented Mar 17, 2017

Rule Details

This rule warns against not using the lang attribute on the html element, or using it on the html element but with the value of empty string.

It's indicated to always set the lang attribute on the html element so that it's inherited by all other elements (even the ones in the <head>), and it sets the primary language of the document.

Setting the lang attribute provides an explicit indicate to user agents about the language of the content, which can help, among other:

Resources


Note: This rule does not check if the value of the lang attribute is valid or not (that will be covered by a different rule).


Close #16

@alrra alrra requested a review from molant March 17, 2017 13:14
report: sinon.spy()
};

const window = await getDOM(path.join(__dirname, 'fixtures', filePath));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@molant IMHO, having the fixtures right next to the test file is better.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what I was thinking yesterday while doing some tests. I'll refactor the other ones today.

@@ -74,7 +74,7 @@ export class RuleContext {
this.id,
this.severity,
descriptor,
location,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a leftover from when the "find element" related refactoring was done.


import { Rule, RuleBuilder, ElementFoundEvent } from '../../../../lib/types'; // eslint-disable-line no-unused-vars

const getDOM = async (filePath) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@molant This will probably go into a separate file as it will be needed in a few places.

@molant molant merged commit 384bcde into webhintio:master Mar 17, 2017
@alrra alrra deleted the fix-16 branch March 18, 2017 22:42
qzhou1607-zz referenced this pull request in qzhou1607-zz/Sonar-private May 17, 2017
* Add index page in each folder according to #45
* A PR will be submitted in sonarwhal to process the index pages
qzhou1607-zz referenced this pull request in qzhou1607-zz/Sonar-private May 17, 2017
* Add index page in each folder according to #45
* Another PR is submitted in sonarwhal to process the index pages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants