src/LiveDevelopment/LiveDevMultiBrowser.js
function _styleSheetAdded(event, url, roots) {
        var path = _server && _server.urlToPath(url),
            alreadyAdded = !!_relatedDocuments[url];

        // path may be null if loading an external stylesheet.
        // Also, the stylesheet may already exist and be reported as added twice
        // due to Chrome reporting added/removed events after incremental changes
        // are pushed to the browser
        if (!path || alreadyAdded) {
            return;
        }

        var docPromise = DocumentManager.getDocumentForPath(path);

        docPromise.done(function (doc) {
            if ((_classForDocument(doc) === LiveCSSDocument) &&
                    (!_liveDocument || (doc !== _liveDocument.doc))) {
                var liveDoc = _createLiveDocument(doc, doc._masterEditor, roots);
                if (liveDoc) {
                    _server.add(liveDoc);
                    _relatedDocuments[doc.url] = liveDoc;
                    liveDoc.on("updateDoc", function (event, url) {
                        var path = _server.urlToPath(url),
                            doc = getLiveDocForPath(path);
                        doc._updateBrowser();
                    });
                }
            }
        });
    }
function _styleSheetAdded(event, url, roots) {
        var path = _server && _server.urlToPath(url),
            alreadyAdded = !!_relatedDocuments[url];

        // path may be null if loading an external stylesheet.
        // Also, the stylesheet may already exist and be reported as added twice
        // due to Chrome reporting added/removed events after incremental changes
        // are pushed to the browser
        if (!path || alreadyAdded) {
            return;
        }

        var docPromise = DocumentManager.getDocumentForPath(path);

        docPromise.done(function (doc) {
            if ((_classForDocument(doc) === LiveCSSDocument) &&
                    (!_liveDocument || (doc !== _liveDocument.doc))) {
                var liveDoc = _createLiveDocument(doc, doc._masterEditor, roots);
                if (liveDoc) {
                    _server.add(liveDoc);
                    _relatedDocuments[doc.url] = liveDoc;
                    liveDoc.on("updateDoc", function (event, url) {
                        var path = _server.urlToPath(url),
                            doc = getLiveDocForPath(path);
                        doc._updateBrowser();
                    });
                }
            }
        });
    }
function _styleSheetAdded ( event , url , roots ) { var path = _server && _server . urlToPath ( url ) , alreadyAdded = ! ! _relatedDocuments [ url ] ; // path may be null if loading an external stylesheet. // Also, the stylesheet may already exist and be reported as added twice // due to Chrome reporting added/removed events after incremental changes // are pushed to the browser if ( ! path || alreadyAdded ) { return ; } var docPromise = DocumentManager . getDocumentForPath ( path ) ; docPromise . done ( function ( doc ) { if ( ( _classForDocument ( doc ) === LiveCSSDocument ) && ( ! _liveDocument || ( doc !== _liveDocument . doc ) ) ) { var liveDoc = _createLiveDocument ( doc , doc . _masterEditor , roots ) ; if ( liveDoc ) { _server . add ( liveDoc ) ; _relatedDocuments [ doc . url ] = liveDoc ; liveDoc . on ( "updateDoc" , function ( event , url ) { var path = _server . urlToPath ( url ) , doc = getLiveDocForPath ( path ) ; doc . _updateBrowser ( ) ; } ) ; } } } ) ; }
Handles a notification from the browser that a stylesheet was loaded into
the live HTML document. If the stylesheet maps to a file in the project, then
creates a live document for the stylesheet and adds it to _relatedDocuments.
@param {$.Event} event
@param {string} url The URL of the stylesheet that was added.
@param {array} roots The URLs of the roots of the stylesheet (the css files loaded through <link>)
Handles a notification from the browser that a stylesheet was loaded into the live HTML document . If the stylesheet maps to a file in the project then creates a live document for the stylesheet and adds it to _relatedDocuments .