First I create element :
var link = document.createElement('a');
And my document is loaded, styles and scripts are in effect.
styles migt be for example:
a { background-color: salmon; }
so it applies to all A tags.
Does this newly created element in those circumstances has all CSS propertions set to their defaults as put in specification and is styled while inserted into DOM or is styled right at creation.
No, until the element’s attached to the DOM it remains unstyled. Or, at least, its computed-style is unavailable (presumably because it’s not yet rendered):
HTML:
CSS:
JavaScript:
JS Fiddle.
If, however, you explicitly style the element with JavaScript, which adds to the
styleattribute of the created element, that styling information is available immediately (albeit still not via thegetComputedStyle()):JS Fiddle.