| Index: Source/core/dom/ProcessingInstruction.js
|
| diff --git a/Source/core/dom/ProcessingInstruction.js b/Source/core/dom/ProcessingInstruction.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..d5a03acc839c4bff738031710e04bd1dde3a81a3
|
| --- /dev/null
|
| +++ b/Source/core/dom/ProcessingInstruction.js
|
| @@ -0,0 +1,69 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +"use strict";
|
| +
|
| +installClass("ProcessingInstruction", function(global, ProcessingInstructionPrototype) {
|
| +
|
| + ProcessingInstructionPrototype.registerSheet = function(parsing) {
|
| + if (!global.document.xslStyleSheetInitialized_) {
|
| + global.document.parsing = parsing;
|
| + global.document.xslStyleSheetLoaded = [];
|
| + global.document.xslStyleSheet = [];
|
| + global.document.xslStyleSheetInitialized_ = true;
|
| +
|
| + global.document.addEventListener('DOMContentLoaded', function() {
|
| + global.document.parsing = false;
|
| + var found = false;
|
| + for (var index = 0; index < global.document.xslStyleSheetLoaded.length; index++) {
|
| + if (global.document.xslStyleSheetLoaded[index] == global.document.xslStyleSheet[0]) {
|
| + found = true;
|
| + break;
|
| + }
|
| + }
|
| + if (!found)
|
| + return;
|
| + if (global.document.transformSourceDocument)
|
| + return;
|
| + global.document.applyXSLTransform(global.document.xslStyleSheet[0]);
|
| + }, false);
|
| + }
|
| +
|
| + if (global.document.xslStyleSheet.length == 0) {
|
| + global.document.xslStyleSheet.push(this);
|
| + return;
|
| + }
|
| +
|
| + for (var index = 0; index < global.document.xslStyleSheet.length; index++) {
|
| + var position = global.document.xslStyleSheet[index].compareDocumentPosition(this);
|
| + if (position & Node.DOCUMENT_POSITION_PRECEDING) {
|
| + global.document.xslStyleSheet.splice(index, 0, this);
|
| + return;
|
| + }
|
| + }
|
| + }
|
| +
|
| + ProcessingInstructionPrototype.unregisterSheet = function() {
|
| + for (var index = 0; index < global.document.xslStyleSheet.length; index++) {
|
| + if (global.document.xslStyleSheet[index] == this) {
|
| + global.document.xslStyleSheet.splice(index, 1);
|
| + break;
|
| + }
|
| + }
|
| + for (var index = 0; index < global.document.xslStyleSheetLoaded.length; index++) {
|
| + if (!global.document.xslStyleSheetLoaded[index] == this) {
|
| + global.document.xslStyleSheetLoaded.splice(index, 1);
|
| + break;
|
| + }
|
| + }
|
| + }
|
| +
|
| + ProcessingInstructionPrototype.sheetLoadedCallback = function() {
|
| + global.document.xslStyleSheetLoaded.push(this);
|
| + if (global.document.xslStyleSheet[0] != this || global.document.parsing || global.document.transformSourceDocument)
|
| + return;
|
| + global.document.applyXSLTransform(global.document.xslStyleSheet[0]);
|
| + }
|
| +});
|
| +
|
|
|