function checkNameAttribute(element)
{
is(element.name, "output-name", "Output name IDL attribute is not correct");
is(element.getAttribute('name'), "output-name", "Output name content attribute is not correct");
}
function checkValueAndDefaultValueIDLAttribute(element)
{
is(element.value, element.textContent, "The value IDL attribute should act like the textContent IDL attribute");
element.value = "foo";
is(element.value, "foo", "Value should be 'foo'");
is(element.defaultValue, "tulip", "Default defaultValue is 'tulip'");
element.defaultValue = "bar";
is(element.defaultValue, "bar", "defaultValue should be 'bar'");
// More complex situation.
element.textContent = 'foo'; var b = document.createElement('b');
b.textContent = 'bar'
element.appendChild(b);
is(element.value, element.textContent, "The value IDL attribute should act like the textContent IDL attribute");
}
function checkValueModeFlag(element)
{
/**
* The value mode flag is the flag used to know if value should represent the
* textContent or the default value.
*/
// value mode flag should be 'value'
isnot(element.defaultValue, element.value, "When value is set, defaultValue keeps its value");
var f = document.getElementById('f');
f.reset();
// value mode flag should be 'default'
is(element.defaultValue, element.value, "When reset, defaultValue=value");
is(element.textContent, element.defaultValue, "textContent should contain the defaultValue");
}
function checkDescendantChanged(element)
{
/**
* Whenever a descendant is changed if the value mode flag is value,
* the default value should be the textContent value.
*/
element.defaultValue = 'tulip';
element.value = 'foo';
// set value mode flag to 'default' var f = document.getElementById('f');
f.reset();
is(element.textContent, element.defaultValue, "textContent should contain the defaultValue");
element.textContent = "bar";
is(element.textContent, element.defaultValue, "textContent should contain the defaultValue");
}
function checkFormIDLAttribute(element)
{
is(element.form, document.getElementById('f'), "form IDL attribute is invalid");
}
function checkHtmlForIDLAttribute(element)
{
is(String(element.htmlFor), 'a b', "htmlFor IDL attribute should reflect the for content attribute");
// DOMTokenList is tested in another bug so we just test assignation
element.htmlFor.value = 'a b c';
is(String(element.htmlFor), 'a b c', "htmlFor should have changed");
}
function submitForm()
{
// Setting the values for the submit.
document.getElementById('o').value = 'foo';
document.getElementById('a').value = 'afield';
document.getElementById('b').value = 'bfield';
frameLoaded = checkFormSubmission;
// This will call checkFormSubmission() which is going to call ST.finish().
document.getElementById('f').submit();
}
function checkFormSubmission()
{
/**
* All elements values have been set just before the submission.
* The input elements values should be in the submit url but the ouput
* element value should not appear.
*/
is(frames.submit_frame.location.href,
`${location.origin}/tests/dom/html/test/forms/foo?a=afield&b=bfield`, "The output element value should not be submitted");
SimpleTest.finish();
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.