@
@
@cratte2018-04-18 14:38:59
css
@cratte, 2018-04-18 14:38:59

Why is the CSS file with the disabled attribute loaded twice?

Hello!
If you set the disabled property (or attribute, whatever) to the CSS file,

<head>
    <link rel="stylesheet" href="/some.css" disabled>
    ...
    </head>

and then click to delete this property, then the file is loaded twice.
$( document ).find( '[href $= "some.css"]' ).prop( 'disabled', false );

If you remove it again and then assign the property, the file is not loaded again.
File loaded on page load
5ad72e26bffff2738664059.jpeg
File loaded on click event
5ad72e31b37e5759637949.jpeg
This happens in Chrome and Opera, not in Mozilla and IE.
Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Max Developer, 2018-04-18
@maximviktorovich777

let's start with the fact that this tag does not have such an attribute
https://www.w3schools.com/tags/tag_link.asp

@
@cratte, 2018-04-19
Asker

The link tag has a disabled property:
https://developer.mozilla.org/en/docs/Web/HTML/Ele...
https://www.w3.org/TR/2000/REC-DOM-Level-2 -Style-2...
My problem is that mozilla doesn't honor this attribute if it's set when loading resources. This issue is covered in more detail here: https://stackoverflow.com/questions/18237591/firef...
I decided to stop using the disabled property, since browsers behave differently when using it, now I dynamically create a css file and upload it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question