chrome-devtools-autosave icon indicating copy to clipboard operation
chrome-devtools-autosave copied to clipboard

Accounting for new event type!

Open drewcovi opened this issue 12 years ago • 12 comments

I finally found the issue!

Turns out in some cases, the event type is "font" but needs to be handled exactly how document is currently handled.

In the process, I added an option and removed it (as i dont see it as necessary to opt into font changes) however this did cause an error in the mapping of options.js. So I also built in a fallback in the case that an input is not discovered and returns undefined.

drewcovi avatar Mar 14 '12 15:03 drewcovi

I don’t yet see what the problem is. How could onResourceContentCommitted fire with event.type font? Could you provide example page?

NV avatar Mar 14 '12 18:03 NV

I can give it a shot. Can't honestly say what environment variable came into play, but console logging the event type in devtools.html showed "font". Typically after refreshes and only on newly created styles. I would assume this only applies to newly created inline element styles.

drewcovi avatar Mar 14 '12 19:03 drewcovi

hey Nikita, how can I provide an example page to you that you can set up? zip file?

drewcovi avatar Mar 15 '12 14:03 drewcovi

https://gist.github.com/ ?

NV avatar Mar 15 '12 14:03 NV

ill do that. also on a related note, ive found that if you have a stylesheet before and after an external script include, the document.head.querySelectorAll("link[rel=stylesheet][href]") tends to only return those that fall before.... could be more to this but ill make up a test case.

drewcovi avatar Mar 20 '12 19:03 drewcovi

on further thought this makes perfect sense, since js is going to block and that event doesnt wait for domready. guess thats all the more reason to push your js to the bottom of the page. im just working in an older environment that can't be easily updated to that end.

drewcovi avatar Mar 20 '12 22:03 drewcovi

ive found that if you have a stylesheet before and after an external script include, the document.head.querySelectorAll("link[rel=stylesheet][href]") tends to only return those that fall before...

No, it’s not. http://elv1s.ru/x/script-between-stylesheets.html

NV avatar Mar 21 '12 02:03 NV

give it a go with some heavier script includes...

http://dev.drew.co.vi/x/script-between-stylesheets.html

for these screenshots I changed these lines (starting at 57 in devtools):

    chrome.experimental.devtools.inspectedWindow.eval('(function() {\n\
    var links = document.head.querySelectorAll("link[rel=stylesheet][href]");\n\
    var last = links[links.length - 1];\n\
    console.log(document.head.innerHTML);\n\
    return last && last.href})()', function(href, fail) {
        if (fail) return;
        console.log(href);

href value console.log

header truncated

drewcovi avatar Mar 21 '12 02:03 drewcovi

After 28dc2bd3dda7d69f3c991af1456b747af40d957b getLastStylesheetURL executes lazily on adding new CSS rule, so it should be fixed. Check out version from the repo.

NV avatar Mar 21 '12 23:03 NV

Is any of this still relevant?

NV avatar Jun 09 '12 17:06 NV

I keep getting it sometimes. But admittedly less so as of late since I've been using the style sheet in the body technique.

drewcovi avatar Jun 09 '12 22:06 drewcovi

DevTools console is much more verbose now. Provide an output from it next time the problem happens.

NV avatar Jun 09 '12 22:06 NV