-
Notifications
You must be signed in to change notification settings - Fork 46
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
[WIP] add forwards compatibility / graceful degradation principle. #468
Draft
hober
wants to merge
2
commits into
main
Choose a base branch
from
graceful-degradation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -294,6 +294,7 @@ Parts of the web platform evolve independently. | |||||
Issues that are present with a certain web technology now may be fixed in a subsequent iteration. | ||||||
Duplicating these issues makes fixing them more difficult. | ||||||
By adhering to this principle we can make sure overall platform quality improves over time. | ||||||
|
||||||
<h2 id="api-across-languages">API Design Across Languages</h2> | ||||||
|
||||||
<h3 id="simplicity">Prefer simple solutions</h3> | ||||||
|
@@ -490,6 +491,120 @@ See also: | |||||
* [[#do-not-expose-use-of-assistive-tech]] | ||||||
* [[#secure-context]] | ||||||
|
||||||
<h3 id=degrade-gracefully>Degrade Gracefully</h3> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
<!-- was "Degrade Gracefully" in the HTML Design Principles --> | ||||||
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TL:DR; summary please! |
||||||
Authors are (understandably) reluctant to use | ||||||
new Web-exposed features | ||||||
that may trigger undesirable behavior in older user agents, | ||||||
or that do not provide some sort of graceful fallback. | ||||||
Web-facing features should be designed | ||||||
so that Web content can degrade gracefully | ||||||
in older or less capable user agents, | ||||||
even when sites make use of the new features. | ||||||
|
||||||
It is not necessary | ||||||
to consider every Web user agent ever made, | ||||||
including even very old versions of browsers | ||||||
or tools that are extremely unpopular even in their niche markets. | ||||||
However, | ||||||
strong consideration should be given | ||||||
to the following categories of user agents. | ||||||
It is highly likely | ||||||
that content authors will find it important | ||||||
to target these categories: | ||||||
|
||||||
* Current versions of the top mainstream Web browsers. | ||||||
* Highly popular older versions of mainstream Web browsers. | ||||||
* The top user agents | ||||||
designed to meet specific needs or address specialized markets, | ||||||
such as assistive technologies or user agents targeting less typical media | ||||||
such as text-only terminals or print. | ||||||
|
||||||
In some cases, | ||||||
a new feature may simply not apply | ||||||
to a certain class of user agents, | ||||||
or may be impractical to design | ||||||
in a way that can degrade. | ||||||
For example, | ||||||
new scripting APIs | ||||||
cannot be made to work | ||||||
in scriptless user agents. | ||||||
But in many cases, | ||||||
approaches like the following | ||||||
can be used: | ||||||
|
||||||
* A new element or attribute | ||||||
may provide additional semantics | ||||||
without losing essential functionality | ||||||
when not understood. | ||||||
* A new scripting method or attribute | ||||||
can be tested before use | ||||||
in script | ||||||
using ECMAScript introspection facilities. | ||||||
* A new element or attribute | ||||||
may provide semantics | ||||||
and a simple default rendering | ||||||
that can be achieved using CSS, | ||||||
so the addition of a small stylesheet | ||||||
allows graceful degradation. | ||||||
* A new element, attribute or scripting API | ||||||
may have behavior | ||||||
that can be emulated | ||||||
through the use of additional script, | ||||||
although the scripted approach | ||||||
may not provide | ||||||
the same level of performance and convenience. | ||||||
* A new element | ||||||
may call for | ||||||
a highly specialized rendering, | ||||||
but allow different content to be provided as fallback | ||||||
for user agents that do not understand the element. | ||||||
|
||||||
This list is not exhaustive; | ||||||
in some cases | ||||||
slightly more complicated approaches | ||||||
are more effective. | ||||||
|
||||||
<p class="example">The default presentation | ||||||
of the <code>hidden</code> attribute | ||||||
can be emulated | ||||||
in older browsers | ||||||
through the CSS rule <code>[hidden] { display: none; }</code>. | ||||||
|
||||||
<p class="example">Multimedia elements | ||||||
like <code><canvas></code> or <code><video></code> | ||||||
allow fallback content. | ||||||
Older user agents | ||||||
will show | ||||||
the fallback content | ||||||
while user agents supporting these elements | ||||||
will show | ||||||
the multimedia content. | ||||||
|
||||||
<p class="example">The <code>getElementsByClassName()</code> method | ||||||
can be made | ||||||
considerably faster than | ||||||
pure ECMAScript implementations | ||||||
found in existing libraries, | ||||||
but a script-based implementation | ||||||
can be used | ||||||
when the native version | ||||||
is not available. | ||||||
|
||||||
<p class="example">The <code><datalist></code> element | ||||||
can be associated | ||||||
with an <code><input></code> element | ||||||
and may contain | ||||||
a hidden <code><select></code> element. | ||||||
This way | ||||||
the fallback | ||||||
for the intended "combo box" control | ||||||
can be | ||||||
a text field | ||||||
or a text field with an associated pop-up menu | ||||||
in older browsers. | ||||||
|
||||||
<h3 id="secure-context">Consider limiting new features to secure contexts</h3> | ||||||
|
||||||
Always limit your feature to secure contexts | ||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vertical whitespace is useful. Why would you remove the space around the h2?
(A more serious problem here is the lack of content between the h2 and the first h3. That's very bad form.