1 |
if (typeof (cx) == "undefined") {
|
2 |
cx = {};
|
3 |
}
|
4 |
if (typeof (cx.fam) == "undefined") {
|
5 |
cx.fam = {};
|
6 |
}
|
7 |
if (typeof (cx.fam.suika) == "undefined") {
|
8 |
cx.fam.suika = {};
|
9 |
}
|
10 |
if (typeof (cx.fam.suika.y2005) == "undefined") {
|
11 |
cx.fam.suika.y2005 = {};
|
12 |
}
|
13 |
if (typeof (cx.fam.suika.y2005.CSS) == "undefined") {
|
14 |
cx.fam.suika.y2005.CSS = {};
|
15 |
}
|
16 |
if (typeof (cx.fam.suika.y2005.CSS.Node) == "undefined") {
|
17 |
cx.fam.suika.y2005.CSS.Node = {};
|
18 |
}
|
19 |
|
20 |
JSAN.require ("cx.fam.suika.y2005.Class.Inherit");
|
21 |
JSAN.require ("cx.fam.suika.y2005.DOM.Implementation");
|
22 |
JSAN.require ("cx.fam.suika.y2005.CSS.Selectors");
|
23 |
JSAN.require ("cx.fam.suika.y2005.CSS.Value");
|
24 |
//JSAN.require ("cx.fam.suika.y2005.CSS.MediaQuery");
|
25 |
JSAN.require ("cx.fam.suika.y2005.CSS.Property");
|
26 |
|
27 |
/**
|
28 |
Interface |DOMImplementationCSS|
|
29 |
|
30 |
The |DOMImplementationCSS| interface from DOM Level 2 CSS module
|
31 |
provides the |createCSSStyleSheet| method that creates a CSS style sheet
|
32 |
object.
|
33 |
|
34 |
Interface |CSSImplementation|
|
35 |
|
36 |
The |CSSImplementation| interface provides a set of factory method
|
37 |
that creates CSS constructions.
|
38 |
*/
|
39 |
cx.fam.suika.y2005.DOM.Implementation.DOMImplementation._AddFeature
|
40 |
("http://suika.fam.cx/www/cx/fam/suika/y2005/CSS/Node#", "1.0", {
|
41 |
/**
|
42 |
Creates a CSS style sheet object.
|
43 |
[DOM Level 2 CSS]
|
44 |
*/
|
45 |
createCSSStyleSheet: function (title, media) {
|
46 |
var ss = new cx.fam.suika.y2005.CSS.Node.StyleSheet ();
|
47 |
if (title != null) ss._SetTitle (title);
|
48 |
//if (media != null) /* not implemented */
|
49 |
return ss;
|
50 |
},
|
51 |
/**
|
52 |
Creates a CSS |@import| rule object.
|
53 |
|
54 |
Note. Creating a |@import| object does not mean to load the referenced
|
55 |
style sheet.
|
56 |
@@ISSUE: Inserting the rule into a style sheet should make
|
57 |
the referenced style sheet loaded?
|
58 |
|
59 |
[non-standard]
|
60 |
|
61 |
@param href The DOM URI of the referenced style sheet.
|
62 |
@param media The media query associated to the rule.
|
63 |
If |null| is specified, then an empty media list
|
64 |
(which is equivalent to |all| by definition) is set.
|
65 |
@return The newly created |@import| rule.
|
66 |
*/
|
67 |
createCSSImportRule: function (href, media) {
|
68 |
return new cx.fam.suika.y2005.CSS.Node.ImportRule (href, media);
|
69 |
},
|
70 |
/**
|
71 |
Creates a CSS |@charset| rule object.
|
72 |
[non-standard]
|
73 |
*/
|
74 |
createCSSCharsetRule: function (charset) {
|
75 |
return new cx.fam.suika.y2005.CSS.Node.CharsetRule (charset);
|
76 |
},
|
77 |
|
78 |
/**
|
79 |
Creates a CSS |@namespace| rule object.
|
80 |
|
81 |
[non-standard]
|
82 |
|
83 |
@param prefix The namespace prefix, or |null| if it defines the
|
84 |
default namespace URI.
|
85 |
@param namespaceURI The namespace URI.
|
86 |
@return The newly created |@namespace| rule.
|
87 |
*/
|
88 |
createCSSNamespaceRule: function (prefix, namespaceURI) {
|
89 |
return new cx.fam.suika.y2005.CSS.Node.NamespaceRule (prefix, namespaceURI);
|
90 |
},
|
91 |
/**
|
92 |
Creates a CSS rule set object.
|
93 |
[non-standard]
|
94 |
*/
|
95 |
createCSSRuleSet: function (selector) {
|
96 |
return new cx.fam.suika.y2005.CSS.Node.RuleSet (selector);
|
97 |
},
|
98 |
/**
|
99 |
Creates a CSS property declaration object.
|
100 |
[non-standard]
|
101 |
|
102 |
@param namespaceURI The namespace URI of the property.
|
103 |
@param prefix The namespace prefix of the property, if any, or |null|.
|
104 |
@param localName The local name of the property.
|
105 |
@param value The value of the property.
|
106 |
*/
|
107 |
createCSSPropertyNS: function (namespaceURI, prefix, localName, value, priority) {
|
108 |
if (priority == null) {
|
109 |
priority = this.createCSSKeywordValueNS
|
110 |
("http://suika.fam.cx/~wakaba/archive/2005/cssc.",
|
111 |
"manakaic", "normal");
|
112 |
}
|
113 |
return new cx.fam.suika.y2005.CSS.Node.PropertyDeclaration
|
114 |
(namespaceURI, prefix, localName, value, priority);
|
115 |
}
|
116 |
});
|
117 |
|
118 |
/**
|
119 |
Constructs a new instance of |CSSNode| - for internal use.
|
120 |
*/
|
121 |
cx.fam.suika.y2005.CSS.Node.Node = function () {
|
122 |
};
|
123 |
|
124 |
/**
|
125 |
The base URI, if available, or |null|.
|
126 |
*/
|
127 |
cx.fam.suika.y2005.CSS.Node.Node.prototype.getBaseURI =
|
128 |
function () {
|
129 |
if (this.parentRule) {
|
130 |
return this.parentRule.getBaseURI ();
|
131 |
} else if (this.parentStyleSheet) {
|
132 |
return this.parentStyleSheet.getBaseURI ();
|
133 |
} else {
|
134 |
return null;
|
135 |
}
|
136 |
};
|
137 |
|
138 |
cx.fam.suika.y2005.CSS.Node.Node.prototype.getCSSNodeType = function () {
|
139 |
return this.CSS_UNKNOWN_NODE;
|
140 |
};
|
141 |
cx.fam.suika.y2005.CSS.Node.Node.prototype.CSS_UNKNOWN_RULE_NODE = 0;
|
142 |
cx.fam.suika.y2005.CSS.Node.Node.prototype.CSS_RULE_SET_NODE = 1;
|
143 |
cx.fam.suika.y2005.CSS.Node.Node.prototype.CSS_AT_CHARSET_NODE = 2;
|
144 |
cx.fam.suika.y2005.CSS.Node.Node.prototype.CSS_AT_IMPORT_NODE = 3;
|
145 |
cx.fam.suika.y2005.CSS.Node.Node.prototype.CSS_AT_MEDIA_NODE = 4;
|
146 |
cx.fam.suika.y2005.CSS.Node.Node.prototype.CSS_AT_FONT_FACE_NODE = 5;
|
147 |
cx.fam.suika.y2005.CSS.Node.Node.prototype.CSS_AT_PAGE_NODE = 6;
|
148 |
cx.fam.suika.y2005.CSS.Node.Node.prototype.CSS_UNKNOWN_NODE = 100;
|
149 |
cx.fam.suika.y2005.CSS.Node.Node.prototype.CSS_STYLE_SHEET_NODE = 101;
|
150 |
cx.fam.suika.y2005.CSS.Node.Node.prototype.CSS_DECLARATION_BLOCK_NODE = 102;
|
151 |
cx.fam.suika.y2005.CSS.Node.Node.prototype.CSS_EMPTY_DECLARATION_NODE = 103;
|
152 |
cx.fam.suika.y2005.CSS.Node.Node.prototype.CSS_PROPERTY_DECLARATION_NODE = 104;
|
153 |
cx.fam.suika.y2005.CSS.Node.Node.prototype.CSS_AT_NAMESPACE_NODE = 106;
|
154 |
|
155 |
/**
|
156 |
The textual representation of the node.
|
157 |
[non-standard]
|
158 |
*/
|
159 |
cx.fam.suika.y2005.CSS.Node.Node.prototype.getCSSText = function () {
|
160 |
return null;
|
161 |
};
|
162 |
cx.fam.suika.y2005.CSS.Node.Node.prototype.setCSSText = function (newValue) {};
|
163 |
|
164 |
/**
|
165 |
Returns the namespace URI associated to a namespace prefix,
|
166 |
if any, or |null|.
|
167 |
[non-standard]
|
168 |
|
169 |
@param prefix The namespace prefix to lookup. If |null|, default
|
170 |
namespace URI, if any, is returned. Note that in CSS
|
171 |
identifiers including prefixes are case-insensitive.
|
172 |
@return The namespace URI associated with |prefix|, if any, or |null|.
|
173 |
*/
|
174 |
cx.fam.suika.y2005.CSS.Node.Node.prototype.lookupNamespaceURI =
|
175 |
function (prefix) {
|
176 |
if (this.parentRule) {
|
177 |
return this.parentRule.lookupNamespaceURI (prefix);
|
178 |
} else if (this.parentStyleSheet) {
|
179 |
return this.parentStyleSheet.lookupNamespaceURI (prefix);
|
180 |
} else {
|
181 |
return null;
|
182 |
}
|
183 |
};
|
184 |
|
185 |
/**
|
186 |
Escapes a string as an |IDENT|.
|
187 |
*/
|
188 |
cx.fam.suika.y2005.CSS.Node.Node.prototype._EscapeIdent =
|
189 |
cx.fam.suika.y2005.CSS.Value._EscapeIdent;
|
190 |
|
191 |
cx.fam.suika.y2005.CSS.Node.Node.prototype.toString = function () {
|
192 |
return "[object CSSNode]";
|
193 |
};
|
194 |
|
195 |
|
196 |
/**
|
197 |
Interface |CSSStyleSheet|
|
198 |
|
199 |
A |CSSStyleSheet| object represents a CSS style sheet.
|
200 |
*/
|
201 |
cx.fam.suika.y2005.CSS.Node.StyleSheet = function () {
|
202 |
cx.fam.suika.y2005.CSS.Node.StyleSheet._superclass.apply (this, arguments);
|
203 |
this.cssRules = new cx.fam.suika.y2005.CSS.RuleList ();
|
204 |
};
|
205 |
cx.fam.suika.y2005.CSS.Node.StyleSheet.inherits (cx.fam.suika.y2005.CSS.Node.Node);
|
206 |
cx.fam.suika.y2005.CSS.Node.StyleSheet.prototype.getCSSNodeType = function () {
|
207 |
return cx.fam.suika.y2005.CSS.Node.Node.prototype.CSS_STYLE_SHEET_NODE;
|
208 |
};
|
209 |
|
210 |
/**
|
211 |
Appends a |CSSRule| to the list.
|
212 |
[non-standard]
|
213 |
*/
|
214 |
cx.fam.suika.y2005.CSS.Node.StyleSheet.prototype.appendCSSRule = function (newRule) {
|
215 |
/* There should be |HIERARCHY_REQUEST_ERR|. */
|
216 |
newRule._SetParentStyleSheet (this);
|
217 |
newRule._SetParentRule (null);
|
218 |
return this.cssRules.v.push (newRule);
|
219 |
};
|
220 |
|
221 |
/**
|
222 |
The base URI of the style sheet. If it is not explicitly set,
|
223 |
then |href| is the base URI. If |href| is not defined neither,
|
224 |
then |null|.
|
225 |
[non-standard]
|
226 |
*/
|
227 |
cx.fam.suika.y2005.CSS.Node.StyleSheet.prototype.getBaseURI = function () {
|
228 |
if (this.baseURI != null) {
|
229 |
return this.baseURI;
|
230 |
} else {
|
231 |
return this.href;
|
232 |
}
|
233 |
};
|
234 |
cx.fam.suika.y2005.CSS.Node.StyleSheet.prototype._SetBaseURI = function (newValue) {
|
235 |
this.baseURI = newValue;
|
236 |
};
|
237 |
|
238 |
/**
|
239 |
The list of rules, i.e. rule sets and at-rules.
|
240 |
[DOM Level 2 CSS]
|
241 |
*/
|
242 |
cx.fam.suika.y2005.CSS.Node.StyleSheet.prototype.getCSSRules = function () {
|
243 |
return this.cssRules;
|
244 |
};
|
245 |
|
246 |
/**
|
247 |
The textual representation of the style sheet.
|
248 |
[non-standard]
|
249 |
*/
|
250 |
cx.fam.suika.y2005.CSS.Node.StyleSheet.prototype.getCSSText = function () {
|
251 |
var r = "";
|
252 |
var lastType = this.CSS_UNKNOWN_RULE_NODE;
|
253 |
for (var i = 0; i < this.cssRules.v.length; i++) {
|
254 |
var rule = this.cssRules.v[i];
|
255 |
if (lastType == this.CSS_RULE_SET_NODE ||
|
256 |
rule.getCSSNodeType () == this.CSS_RULE_SET_NODE) {
|
257 |
r += "\n";
|
258 |
}
|
259 |
lastType = rule.getCSSNodeType ();
|
260 |
r += rule.getCSSText ();
|
261 |
}
|
262 |
/* TODO: Namespace fixup */
|
263 |
return r;
|
264 |
};
|
265 |
|
266 |
/**
|
267 |
Whether the style sheet is applied to the document or not.
|
268 |
[DOM Level 2 Style Sheets]
|
269 |
*/
|
270 |
cx.fam.suika.y2005.CSS.Node.StyleSheet.prototype.getDisabled = function () {
|
271 |
return this.disabled;
|
272 |
};
|
273 |
cx.fam.suika.y2005.CSS.Node.StyleSheet.prototype.setDisabled = function (newValue) {
|
274 |
this.disabled = newValue;
|
275 |
};
|
276 |
|
277 |
/**
|
278 |
The URI of the style sheet document, if available, or |null|.
|
279 |
[DOM Level 2 Style Sheets]
|
280 |
*/
|
281 |
cx.fam.suika.y2005.CSS.Node.StyleSheet.prototype.getHref = function () {
|
282 |
return this.href;
|
283 |
};
|
284 |
cx.fam.suika.y2005.CSS.Node.StyleSheet.prototype._SetHref = function (newValue) {
|
285 |
this.href = newValue;
|
286 |
};
|
287 |
|
288 |
/* Not implemented: |media|, |ownerNode| from DOM Level 2 Style Sheets,
|
289 |
|setCSSText| */
|
290 |
|
291 |
/**
|
292 |
Returns the namespace URI associated to a namespace prefix,
|
293 |
if any, or |null|.
|
294 |
[non-standard]
|
295 |
|
296 |
@param prefix The namespace prefix to lookup. If |null|, default
|
297 |
namespace URI, if any, is returned. Note that in CSS
|
298 |
identifiers including prefixes are case-insensitive.
|
299 |
@return The namespace URI associated with |prefix|, if any, or |null|.
|
300 |
*/
|
301 |
cx.fam.suika.y2005.CSS.Node.StyleSheet.prototype.lookupNamespaceURI =
|
302 |
function (prefix) {
|
303 |
if (prefix != null) prefix = prefix.toLowerCase ();
|
304 |
var uri = null;
|
305 |
for (var i = 0; i < this.cssRules.v.length; i++) {
|
306 |
var rule = this.cssRules.v[i];
|
307 |
var ruleType = rule.getType ();
|
308 |
if (ruleType == rule.NAMESPACE_RULE) {
|
309 |
if (rule.getPrefix () == prefix) {
|
310 |
uri = rule.getNamespaceURI ();
|
311 |
}
|
312 |
/* Don't |break|, since last occurence is in effect if there is
|
313 |
more than one declarations. */
|
314 |
} else if (ruleType != rule.CHARSET_RULE &&
|
315 |
ruleType != rule.IMPORT_RULE) {
|
316 |
break;
|
317 |
}
|
318 |
}
|
319 |
return uri;
|
320 |
};
|
321 |
|
322 |
/**
|
323 |
The rule that references the style sheet, if any, or |null| otherwise.
|
324 |
[DOM Level 2 CSS]
|
325 |
*/
|
326 |
cx.fam.suika.y2005.CSS.Node.StyleSheet.prototype.getOwnerRule = function () {
|
327 |
return this.ownerRule;
|
328 |
};
|
329 |
cx.fam.suika.y2005.CSS.Node.StyleSheet.prototype._SetOwnerRule = function (newValue) {
|
330 |
this.ownerRule = newValue;
|
331 |
};
|
332 |
|
333 |
/**
|
334 |
The parent style sheet, if any, or |null|.
|
335 |
[DOM Level 2 Style Sheets]
|
336 |
*/
|
337 |
cx.fam.suika.y2005.CSS.Node.StyleSheet.prototype.getParentStyleSheet = function () {
|
338 |
return this.parentStyleSheet;
|
339 |
};
|
340 |
cx.fam.suika.y2005.CSS.Node.StyleSheet.prototype._SetParentStyleSheet =
|
341 |
function (newValue) {
|
342 |
this.parentStyleSheet = newValue;
|
343 |
for (var i = 0; i < this.cssRules.v.length; i++) {
|
344 |
this.cssRules.v[i]._SetParentStyleSheet (newValue);
|
345 |
}
|
346 |
};
|
347 |
|
348 |
/**
|
349 |
The title of the style sheet, if any, or |null|.
|
350 |
[DOM Level 2 Style Sheets]
|
351 |
*/
|
352 |
cx.fam.suika.y2005.CSS.Node.StyleSheet.prototype.getTitle = function () {
|
353 |
return this.title;
|
354 |
};
|
355 |
cx.fam.suika.y2005.CSS.Node.StyleSheet.prototype._SetTitle =
|
356 |
function (newValue) {
|
357 |
this.title = newValue;
|
358 |
};
|
359 |
|
360 |
/**
|
361 |
The Internet media type of the style sheet.
|
362 |
[DOM Level 2 Style Sheets]
|
363 |
*/
|
364 |
cx.fam.suika.y2005.CSS.Node.StyleSheet.prototype.getType = function () {
|
365 |
return "text/css";
|
366 |
};
|
367 |
|
368 |
cx.fam.suika.y2005.CSS.Node.StyleSheet.prototype.toString = function () {
|
369 |
return "[object CSSStyleSheet]";
|
370 |
};
|
371 |
|
372 |
/* Not implemented: |insertRule|, |deleteRule| from DOM Level 2 CSS */
|
373 |
|
374 |
|
375 |
/*
|
376 |
Interface |CSSRule|
|
377 |
|
378 |
A |CSSRule| represents a rule set or at-rule (i.e. a |statement|
|
379 |
in CSS source document).
|
380 |
*/
|
381 |
cx.fam.suika.y2005.CSS.Node.Rule = function () {
|
382 |
cx.fam.suika.y2005.CSS.Node.Rule._superclass.apply (this, arguments);
|
383 |
};
|
384 |
cx.fam.suika.y2005.CSS.Node.Rule.inherits (cx.fam.suika.y2005.CSS.Node.Node);
|
385 |
|
386 |
/**
|
387 |
Appends a |CSSRule| to the list.
|
388 |
[non-standard]
|
389 |
*/
|
390 |
cx.fam.suika.y2005.CSS.Node.Rule.prototype.appendCSSRule = function (newRule) {
|
391 |
/* There should be |HIERARCHY_REQUEST_ERR|. */
|
392 |
newRule._SetParentStyleSheet (this.parentStyleSheet);
|
393 |
newRule._SetParentRule (this);
|
394 |
return this.cssRules.v.push (newRule);
|
395 |
};
|
396 |
|
397 |
/**
|
398 |
The textual representation of the rule.
|
399 |
[DOM Level 2 CSS]
|
400 |
|
401 |
Note that namespace fix up is not done.
|
402 |
*/
|
403 |
cx.fam.suika.y2005.CSS.Node.Rule.prototype.getCSSText =
|
404 |
function () {
|
405 |
return "@" + this._EscapeIdent (this.getRuleName ()) + ";\n";
|
406 |
};
|
407 |
/* Not implemented: |setCSSText| from DOM Level 2 CSS */
|
408 |
|
409 |
/*
|
410 |
The rule that contains this rule, if any, or |null| otherwise.
|
411 |
[DOM Level 2 CSS]
|
412 |
*/
|
413 |
cx.fam.suika.y2005.CSS.Node.Rule.prototype.getParentRule = function () {
|
414 |
return this.parentRule;
|
415 |
};
|
416 |
cx.fam.suika.y2005.CSS.Node.Rule.prototype._SetParentRule = function (newValue) {
|
417 |
this.parentRule = newValue;
|
418 |
};
|
419 |
|
420 |
/*
|
421 |
The style sheet that contains the rule.
|
422 |
[DOM Level 2 CSS]
|
423 |
|
424 |
It might be |null| if the rule is not part of any style sheet
|
425 |
in this implementation.
|
426 |
*/
|
427 |
cx.fam.suika.y2005.CSS.Node.Rule.prototype.getParentStyleSheet = function () {
|
428 |
return this.parentStyleSheet;
|
429 |
};
|
430 |
cx.fam.suika.y2005.CSS.Node.Rule.prototype._SetParentStyleSheet = function (newValue) {
|
431 |
this.parentStyleSheet = newValue;
|
432 |
if (this.cssRules) {
|
433 |
for (var i = 0; i < this.cssRules.v.length; i++) {
|
434 |
this.cssRules.v[i]._SetParentStyleSheet (mewValue);
|
435 |
}
|
436 |
}
|
437 |
};
|
438 |
|
439 |
/**
|
440 |
The local name of the rule. If the rule is not an at-rule, |null|.
|
441 |
[non-standard]
|
442 |
*/
|
443 |
cx.fam.suika.y2005.CSS.Node.Rule.prototype.getRuleLocalName = function () {
|
444 |
return this.ruleLocalName;
|
445 |
};
|
446 |
|
447 |
/**
|
448 |
The qualified name of the rule. If the rule is not an at-rule, |null|.
|
449 |
[non-standard]
|
450 |
*/
|
451 |
cx.fam.suika.y2005.CSS.Node.Rule.prototype.getRuleName = function () {
|
452 |
if (this.ruleNamespaceURI == "urn:x-suika-fam-cx:css:") {
|
453 |
return this.ruleLocalName;
|
454 |
} else {
|
455 |
return "-" + this.rulePrefix + "-" + this.ruleLocalName;
|
456 |
}
|
457 |
};
|
458 |
|
459 |
/**
|
460 |
The namespace URI of the rule. If the rule is not an at-rule, |null|.
|
461 |
[non-standard]
|
462 |
*/
|
463 |
cx.fam.suika.y2005.CSS.Node.Rule.prototype.getRuleNamespaceURI = function () {
|
464 |
return this.ruleNamespaceURI;
|
465 |
};
|
466 |
|
467 |
/**
|
468 |
The namespace prefix of the rule. If the rule is not an at-rule
|
469 |
or the rule has no namespace prefix, |null|.
|
470 |
[non-standard]
|
471 |
*/
|
472 |
cx.fam.suika.y2005.CSS.Node.Rule.prototype.getRulePrefix = function () {
|
473 |
return this.rulePrefix;
|
474 |
};
|
475 |
cx.fam.suika.y2005.CSS.Node.Rule.prototype.setRulePrefix = function (newValue) {
|
476 |
this.rulePrefix = newValue;
|
477 |
};
|
478 |
|
479 |
/**
|
480 |
The type of the rule.
|
481 |
[DOM Level 2 CSS]
|
482 |
*/
|
483 |
cx.fam.suika.y2005.CSS.Node.Rule.prototype.getType = function () {
|
484 |
return this.UNKNOWN_RULE;
|
485 |
};
|
486 |
cx.fam.suika.y2005.CSS.Node.Rule.prototype.UNKNOWN_RULE = 0;
|
487 |
cx.fam.suika.y2005.CSS.Node.Rule.prototype.STYLE_RULE = 1;
|
488 |
cx.fam.suika.y2005.CSS.Node.Rule.prototype.CHARSET_RULE = 2;
|
489 |
cx.fam.suika.y2005.CSS.Node.Rule.prototype.IMPORT_RULE = 3;
|
490 |
cx.fam.suika.y2005.CSS.Node.Rule.prototype.MEDIA_RULE = 4;
|
491 |
cx.fam.suika.y2005.CSS.Node.Rule.prototype.FONT_FACE_RULE = 5;
|
492 |
cx.fam.suika.y2005.CSS.Node.Rule.prototype.PAGE_RULE = 6;
|
493 |
|
494 |
/**
|
495 |
|@namespace| rule.
|
496 |
[non-standard]
|
497 |
|
498 |
Note. The |type| value of |@namespace| rules is |0|,
|
499 |
i.e. |UNKNOWN_RULE|, in Gecko.
|
500 |
*/
|
501 |
cx.fam.suika.y2005.CSS.Node.Rule.prototype.NAMESPACE_RULE = 1001;
|
502 |
|
503 |
/**
|
504 |
Interface |CSSAtRule|
|
505 |
*/
|
506 |
cx.fam.suika.y2005.CSS.Node.AtRule = function (namespaceURI, localName) {
|
507 |
cx.fam.suika.y2005.CSS.Node.AtRule._superclass.apply (this, []);
|
508 |
this.ruleNamespaceURI = namespaceURI;
|
509 |
this.ruleLocalName = localName.toLowerCase ();
|
510 |
};
|
511 |
cx.fam.suika.y2005.CSS.Node.AtRule.inherits (cx.fam.suika.y2005.CSS.Node.Rule);
|
512 |
|
513 |
cx.fam.suika.y2005.CSS.Node.AtRule.prototype.toString = function () {
|
514 |
return "[object CSSAtRule]";
|
515 |
};
|
516 |
|
517 |
/**
|
518 |
Interface |CSSMediaRule|
|
519 |
*/
|
520 |
cx.fam.suika.y2005.CSS.Node.MediaRule = function (mq) {
|
521 |
cx.fam.suika.y2005.CSS.Node.MediaRule._superclass.apply
|
522 |
(this, ["urn:x-suika-fam-cx:css:", "media"]);
|
523 |
this.cssRules = new cx.fam.suika.y2005.CSS.RuleList ();
|
524 |
if (mq != null) {
|
525 |
this.media = mq;
|
526 |
} else {
|
527 |
/* TODO: set empty media query */
|
528 |
}
|
529 |
};
|
530 |
cx.fam.suika.y2005.CSS.Node.MediaRule.inherits (cx.fam.suika.y2005.CSS.Node.AtRule);
|
531 |
cx.fam.suika.y2005.CSS.Node.MediaRule.prototype.getCSSNodeType = function () {
|
532 |
return cx.fam.suika.y2005.CSS.Node.Rule.prototype.CSS_AT_MEDIA_NODE;
|
533 |
};
|
534 |
cx.fam.suika.y2005.CSS.Node.MediaRule.prototype.getType = function () {
|
535 |
return cx.fam.suika.y2005.CSS.Node.Rule.prototype.MEDIA_RULE;
|
536 |
};
|
537 |
|
538 |
/**
|
539 |
The list of rules within the |@media| block.
|
540 |
[DOM Level 2 CSS]
|
541 |
*/
|
542 |
cx.fam.suika.y2005.CSS.Node.MediaRule.prototype.getCSSRules = function () {
|
543 |
return this.cssRules;
|
544 |
};
|
545 |
|
546 |
|
547 |
/**
|
548 |
The textual representation of the rule.
|
549 |
[DOM Level 2 CSS]
|
550 |
|
551 |
Note that namespace fix up is not done.
|
552 |
*/
|
553 |
cx.fam.suika.y2005.CSS.Node.MediaRule.prototype.getCSSText =
|
554 |
function () {
|
555 |
var r = "@media";
|
556 |
var mq = this.media.getMediaText ();
|
557 |
if (mq.length > 0) {
|
558 |
r += " " + mq;
|
559 |
}
|
560 |
r += " {\n\n";
|
561 |
for (var i = 0; i < this.cssRules.v.length; i++) {
|
562 |
r += this.cssRules.v[i].getCSSText () + "\n";
|
563 |
}
|
564 |
r += "}\n";
|
565 |
return r;
|
566 |
};
|
567 |
/* Not implemented: |setCSSText| */
|
568 |
|
569 |
/**
|
570 |
The media query.
|
571 |
[DOM Level 2 CSS]
|
572 |
*/
|
573 |
cx.fam.suika.y2005.CSS.Node.MediaRule.prototype.getMedia = function () {
|
574 |
return this.media;
|
575 |
};
|
576 |
|
577 |
/* Not implemented: |insertRule|, |deleteRule| from DOM Level 2 CSS */
|
578 |
|
579 |
cx.fam.suika.y2005.CSS.Node.MediaRule.prototype.toString = function () {
|
580 |
return "[object CSSMediaRule]";
|
581 |
};
|
582 |
|
583 |
|
584 |
/**
|
585 |
Interface |CSSFontFaceRule|
|
586 |
*/
|
587 |
cx.fam.suika.y2005.CSS.Node.FontFaceRule = function () {
|
588 |
cx.fam.suika.y2005.CSS.Node.FontFaceRule._superclass.apply
|
589 |
(this, ["urn:x-suika-fam-cx:css:", "font-face"]);
|
590 |
this.style = new cx.fam.suika.y2005.CSS.Property.MultiValueSet ();
|
591 |
};
|
592 |
cx.fam.suika.y2005.CSS.Node.FontFaceRule.inherits (cx.fam.suika.y2005.CSS.Node.AtRule);
|
593 |
cx.fam.suika.y2005.CSS.Node.FontFaceRule.prototype.getCSSNodeType = function () {
|
594 |
return cx.fam.suika.y2005.CSS.Node.Rule.prototype.CSS_AT_FONT_FACE_NODE;
|
595 |
};
|
596 |
cx.fam.suika.y2005.CSS.Node.FontFaceRule.prototype.getType = function () {
|
597 |
return cx.fam.suika.y2005.CSS.Node.Rule.prototype.FONT_FACE_RULE;
|
598 |
};
|
599 |
|
600 |
/**
|
601 |
The textual representation of the rule.
|
602 |
[DOM Level 2 CSS]
|
603 |
|
604 |
Note that namespace fix up is not done.
|
605 |
*/
|
606 |
cx.fam.suika.y2005.CSS.Node.FontFaceRule.prototype.getCSSText =
|
607 |
function () {
|
608 |
return "@font-face {\n\n"
|
609 |
+ this.style.getCSSText ()
|
610 |
+ "\n}\n";
|
611 |
};
|
612 |
/* Not implemented: |setCSSText| */
|
613 |
|
614 |
/**
|
615 |
The declaration block of the |@font-face| rule.
|
616 |
[DOM Level 2 CSS]
|
617 |
*/
|
618 |
cx.fam.suika.y2005.CSS.Node.FontFaceRule.prototype.getStyle = function () {
|
619 |
return this.style;
|
620 |
};
|
621 |
|
622 |
cx.fam.suika.y2005.CSS.Node.FontFaceRule.prototype.toString = function () {
|
623 |
return "[object CSSFontFaceRule]";
|
624 |
};
|
625 |
|
626 |
|
627 |
|
628 |
/**
|
629 |
Interface |CSSPageRule|
|
630 |
*/
|
631 |
cx.fam.suika.y2005.CSS.Node.PageRule = function () {
|
632 |
cx.fam.suika.y2005.CSS.Node.PageRule._superclass.apply
|
633 |
(this, ["urn:x-suika-fam-cx:css:", "page"]);
|
634 |
};
|
635 |
cx.fam.suika.y2005.CSS.Node.PageRule.inherits (cx.fam.suika.y2005.CSS.Node.AtRule);
|
636 |
cx.fam.suika.y2005.CSS.Node.PageRule.prototype.getCSSNodeType = function () {
|
637 |
return cx.fam.suika.y2005.CSS.Node.Rule.prototype.CSS_AT_PAGE_NODE;
|
638 |
};
|
639 |
cx.fam.suika.y2005.CSS.Node.PageRule.prototype.getType = function () {
|
640 |
return cx.fam.suika.y2005.CSS.Node.Rule.prototype.PAGE_RULE;
|
641 |
};
|
642 |
|
643 |
/**
|
644 |
The textual representation of the rule.
|
645 |
[DOM Level 2 CSS]
|
646 |
|
647 |
Note that namespace fixup is not done.
|
648 |
*/
|
649 |
cx.fam.suika.y2005.CSS.Node.PageRule.prototype.getCSSText =
|
650 |
function () {
|
651 |
var r = "@page";
|
652 |
var sel = this.getSelectorText ();
|
653 |
if (sel.length > 0) {
|
654 |
r += " " + sel;
|
655 |
}
|
656 |
r += " {\n\n"
|
657 |
+ this.style.getCSSText ()
|
658 |
+ "\n}\n";
|
659 |
return r;
|
660 |
};
|
661 |
/* Not implemented: |setCSSText| */
|
662 |
|
663 |
/**
|
664 |
The selector object of the |@page| rule.
|
665 |
[non-standard]
|
666 |
*/
|
667 |
cx.fam.suika.y2005.CSS.Node.PageRule.prototype.getSelectorObject = function () {
|
668 |
return this.selector;
|
669 |
};
|
670 |
cx.fam.suika.y2005.CSS.Node.PageRule.prototype.setSelectorObject =
|
671 |
function (newValue) {
|
672 |
this.selector = newValue;
|
673 |
};
|
674 |
|
675 |
/**
|
676 |
The textual representation of selector of the |@page| rule.
|
677 |
[DOM Level 2 CSS]
|
678 |
|
679 |
Note that namespace fixup is not done.
|
680 |
*/
|
681 |
cx.fam.suika.y2005.CSS.Node.PageRule.prototype.getSelectorText = function () {
|
682 |
return this.selector.getCSSText ();
|
683 |
};
|
684 |
/* Not implemented: |setSelectorText| from DOM Level 2 CSS */
|
685 |
|
686 |
/**
|
687 |
The declaration block of the |@page| rule.
|
688 |
[DOM Level 2 CSS]
|
689 |
*/
|
690 |
cx.fam.suika.y2005.CSS.Node.PageRule.prototype.getStyle = function () {
|
691 |
return this.style;
|
692 |
};
|
693 |
|
694 |
cx.fam.suika.y2005.CSS.Node.PageRule.prototype.toString = function () {
|
695 |
return "[object CSSPageRule]";
|
696 |
};
|
697 |
|
698 |
|
699 |
/**
|
700 |
Interface |CSSImportRule|
|
701 |
*/
|
702 |
cx.fam.suika.y2005.CSS.Node.ImportRule = function (hrefArg, mediaArg) {
|
703 |
cx.fam.suika.y2005.CSS.Node.ImportRule._superclass.apply
|
704 |
(this, ["urn:x-suika-fam-cx:css:", "import"]);
|
705 |
this.href = hrefArg;
|
706 |
if (mediaArg) {
|
707 |
this.media = mediaArg;
|
708 |
} else {
|
709 |
/* TODO: set empty media query */
|
710 |
}
|
711 |
};
|
712 |
cx.fam.suika.y2005.CSS.Node.ImportRule.inherits (cx.fam.suika.y2005.CSS.Node.AtRule);
|
713 |
cx.fam.suika.y2005.CSS.Node.ImportRule.prototype.getCSSNodeType = function () {
|
714 |
return cx.fam.suika.y2005.CSS.Node.Rule.prototype.CSS_AT_IMPORT_NODE;
|
715 |
};
|
716 |
cx.fam.suika.y2005.CSS.Node.ImportRule.prototype.getType = function () {
|
717 |
return cx.fam.suika.y2005.CSS.Node.Rule.prototype.IMPORT_RULE;
|
718 |
};
|
719 |
|
720 |
/**
|
721 |
The textual representation of the rule.
|
722 |
[DOM Level 2 CSS]
|
723 |
|
724 |
Note that namespace fix up is not done.
|
725 |
*/
|
726 |
cx.fam.suika.y2005.CSS.Node.ImportRule.prototype.getCSSText =
|
727 |
function () {
|
728 |
var r = '@import "';
|
729 |
+ this.href.replace (/([\u000A\u000C"\\]|\u000D\u000A?)/g,
|
730 |
function (c) { return "\\" + c })
|
731 |
+ '"';
|
732 |
var mq = this.media.getMediaText ();
|
733 |
if (mq.length > 0) {
|
734 |
r += " " + mq;
|
735 |
}
|
736 |
r += ";\n";
|
737 |
return r;
|
738 |
};
|
739 |
/* Not implemented: |setCSSText| */
|
740 |
|
741 |
/**
|
742 |
The DOM URI of the style sheet to be imported.
|
743 |
[DOM Level 2 CSS]
|
744 |
*/
|
745 |
cx.fam.suika.y2005.CSS.Node.ImportRule.prototype.getHref = function () {
|
746 |
return this.href;
|
747 |
};
|
748 |
|
749 |
/**
|
750 |
The media query of the rule.
|
751 |
[DOM Level 2 CSS]
|
752 |
*/
|
753 |
cx.fam.suika.y2005.CSS.Node.ImportRule.prototype.getMedia = function () {
|
754 |
return this.media;
|
755 |
};
|
756 |
|
757 |
/**
|
758 |
The style sheet referred to by the rule, if it has been loaded,
|
759 |
or |null| otherwise.
|
760 |
[DOM Level 2 CSS]
|
761 |
*/
|
762 |
cx.fam.suika.y2005.CSS.Node.ImportRule.prototype.getStyleSheet = function () {
|
763 |
return this.styleSheet;
|
764 |
};
|
765 |
cx.fam.suika.y2005.CSS.Node.ImportRule.prototype._SetStyleSheet = function (newValue) {
|
766 |
this.styleSheet = newValue;
|
767 |
};
|
768 |
|
769 |
cx.fam.suika.y2005.CSS.Node.ImportRule.prototype.toString = function () {
|
770 |
return "[object CSSImportRule]";
|
771 |
};
|
772 |
|
773 |
|
774 |
/**
|
775 |
Interface |CSSCharsetRule|
|
776 |
*/
|
777 |
cx.fam.suika.y2005.CSS.Node.CharsetRule = function (encodingArg) {
|
778 |
cx.fam.suika.y2005.CSS.Node.CharsetRule._superclass.apply
|
779 |
(this, ["urn:x-suika-fam-cx:css:", "charset"]);
|
780 |
this.encoding = encodingArg;
|
781 |
};
|
782 |
cx.fam.suika.y2005.CSS.Node.CharsetRule.inherits (cx.fam.suika.y2005.CSS.Node.AtRule);
|
783 |
cx.fam.suika.y2005.CSS.Node.CharsetRule.prototype.getCSSNodeType = function () {
|
784 |
return cx.fam.suika.y2005.CSS.Node.Rule.prototype.CSS_AT_CHARSET_NODE;
|
785 |
};
|
786 |
cx.fam.suika.y2005.CSS.Node.CharsetRule.prototype.getType = function () {
|
787 |
return cx.fam.suika.y2005.CSS.Node.Rule.prototype.CHARSET_RULE;
|
788 |
};
|
789 |
|
790 |
/**
|
791 |
The textual representation of the rule.
|
792 |
[DOM Level 2 CSS]
|
793 |
|
794 |
Note that namespace fix up is not done.
|
795 |
*/
|
796 |
cx.fam.suika.y2005.CSS.Node.CharsetRule.prototype.getCSSText =
|
797 |
function () {
|
798 |
return '@charset "'
|
799 |
+ this.encoding.replace (/([\u000A\u000C"\\]|\u000D\u000A?)/g,
|
800 |
function (c) { return "\\" + c })
|
801 |
+ '";\n';
|
802 |
};
|
803 |
/* Not implemented: |setCSSText| */
|
804 |
|
805 |
/**
|
806 |
The charset name.
|
807 |
[DOM Level 2 CSS]
|
808 |
*/
|
809 |
cx.fam.suika.y2005.CSS.Node.CharsetRule.prototype.getEncoding = function () {
|
810 |
return this.encoding;
|
811 |
};
|
812 |
|
813 |
cx.fam.suika.y2005.CSS.Node.CharsetRule.prototype.toString = function () {
|
814 |
return "[object CSSCharsetRule]";
|
815 |
};
|
816 |
|
817 |
|
818 |
/**
|
819 |
Interface |CSSNameSpaceRule|
|
820 |
*/
|
821 |
cx.fam.suika.y2005.CSS.Node.NamespaceRule = function (prefixArg, namespaceURIArg) {
|
822 |
cx.fam.suika.y2005.CSS.Node.NamespaceRule._superclass.apply
|
823 |
(this, ["urn:x-suika-fam-cx:css:", "namespace"]);
|
824 |
this.prefix = prefixArg;
|
825 |
this.namespaceURI = namespaceURIArg;
|
826 |
};
|
827 |
cx.fam.suika.y2005.CSS.Node.NamespaceRule.inherits
|
828 |
(cx.fam.suika.y2005.CSS.Node.AtRule);
|
829 |
cx.fam.suika.y2005.CSS.Node.NamespaceRule.prototype.getCSSNodeType = function () {
|
830 |
return cx.fam.suika.y2005.CSS.Node.Rule.prototype.CSS_AT_NAMESPACE_NODE;
|
831 |
};
|
832 |
cx.fam.suika.y2005.CSS.Node.NamespaceRule.prototype.getType = function () {
|
833 |
return cx.fam.suika.y2005.CSS.Node.Rule.prototype.NAMESPACE_RULE;
|
834 |
};
|
835 |
|
836 |
/**
|
837 |
The textual representation of the rule.
|
838 |
[DOM Level 2 CSS]
|
839 |
*/
|
840 |
cx.fam.suika.y2005.CSS.Node.NamespaceRule.prototype.getCSSText =
|
841 |
function () {
|
842 |
var r = "@namespace";
|
843 |
if (this.prefix != null) r += " " + this._EscapeIdent (this.prefix);
|
844 |
r += ' "'
|
845 |
+ this.namespaceURI.replace (/([\u000A\u000C"\\]|\u000D\u000A?)/g,
|
846 |
function (c) { return "\\" + c })
|
847 |
+ '";\n';
|
848 |
return r;
|
849 |
};
|
850 |
/* Not implemented: |setCSSText| */
|
851 |
|
852 |
/**
|
853 |
The namespace URI.
|
854 |
[non-standard]
|
855 |
*/
|
856 |
cx.fam.suika.y2005.CSS.Node.NamespaceRule.prototype.getNamespaceURI = function () {
|
857 |
return this.namespaceURI;
|
858 |
};
|
859 |
/* Is setter necessary? */
|
860 |
|
861 |
/**
|
862 |
The namespace prefix.
|
863 |
[non-standard]
|
864 |
*/
|
865 |
cx.fam.suika.y2005.CSS.Node.NamespaceRule.prototype.getPrefix = function () {
|
866 |
return this.prefix;
|
867 |
};
|
868 |
/* Is setter necessary? */
|
869 |
|
870 |
cx.fam.suika.y2005.CSS.Node.NamespaceRule.prototype.toString = function () {
|
871 |
return "[object CSSNameSpaceRule]";
|
872 |
};
|
873 |
|
874 |
|
875 |
/**
|
876 |
Interface |CSSUnknownRule|
|
877 |
*/
|
878 |
cx.fam.suika.y2005.CSS.Node.UnknownRule = function (namespaceURI, localName) {
|
879 |
cx.fam.suika.y2005.CSS.Node.UnknownRule._superclass.apply
|
880 |
(this, [namespaceURI, localName]);
|
881 |
};
|
882 |
cx.fam.suika.y2005.CSS.Node.UnknownRule.inherits (cx.fam.suika.y2005.CSS.Node.AtRule);
|
883 |
|
884 |
cx.fam.suika.y2005.CSS.Node.UnknownRule.prototype.toString = function () {
|
885 |
return "[object CSSUnknownRule]";
|
886 |
};
|
887 |
cx.fam.suika.y2005.CSS.Node.UnknownRule.prototype.getCSSNodeType = function () {
|
888 |
return cx.fam.suika.y2005.CSS.Node.Rule.prototype.CSS_UNKNOWN_RULE_NODE;
|
889 |
};
|
890 |
cx.fam.suika.y2005.CSS.Node.UnknownRule.prototype.getType = function () {
|
891 |
return cx.fam.suika.y2005.CSS.Node.Rule.prototype.UNKNOWN_RULE;
|
892 |
};
|
893 |
|
894 |
|
895 |
/**
|
896 |
Interface |CSSStyleRule|
|
897 |
|
898 |
A |CSSStyleRule| object represents a rule set in a CSS style sheet.
|
899 |
*/
|
900 |
cx.fam.suika.y2005.CSS.Node.RuleSet = function (sel) {
|
901 |
cx.fam.suika.y2005.CSS.Node.RuleSet._superclass.apply (this, []);
|
902 |
this.selector = sel;
|
903 |
this.style = new cx.fam.suika.y2005.CSS.Property.MultiValueSet ();
|
904 |
this.style.parentRule = this;
|
905 |
};
|
906 |
cx.fam.suika.y2005.CSS.Node.RuleSet.inherits (cx.fam.suika.y2005.CSS.Node.Rule);
|
907 |
cx.fam.suika.y2005.CSS.Node.RuleSet.prototype.getCSSNodeType = function () {
|
908 |
return cx.fam.suika.y2005.CSS.Node.Rule.prototype.CSS_RULE_SET_NODE;
|
909 |
};
|
910 |
cx.fam.suika.y2005.CSS.Node.RuleSet.prototype.getType = function () {
|
911 |
return cx.fam.suika.y2005.CSS.Node.Rule.prototype.STYLE_RULE;
|
912 |
};
|
913 |
|
914 |
/**
|
915 |
The textual representation of the rule set.
|
916 |
[DOM Level 2 CSS]
|
917 |
|
918 |
Note that namespace fix up is not done.
|
919 |
*/
|
920 |
cx.fam.suika.y2005.CSS.Node.RuleSet.prototype.getCSSText =
|
921 |
function () {
|
922 |
return this.getSelectorText () + " {\n"
|
923 |
+ this.style.getCSSText ()
|
924 |
+ "}\n";
|
925 |
};
|
926 |
/* Not implemented: |setCSSText| from DOM Level 2 CSS */
|
927 |
|
928 |
/* Not implemented: |setSelectorText| from DOM Level 2 CSS */
|
929 |
|
930 |
/**
|
931 |
The selector object of the rule set.
|
932 |
[non-standard]
|
933 |
*/
|
934 |
cx.fam.suika.y2005.CSS.Node.RuleSet.prototype.getSelectorObject = function () {
|
935 |
return this.selector;
|
936 |
};
|
937 |
cx.fam.suika.y2005.CSS.Node.RuleSet.prototype.setSelectorObject = function (newValue) {
|
938 |
this.selector = newValue;
|
939 |
};
|
940 |
|
941 |
/**
|
942 |
A textual representation of the selector of the rule set.
|
943 |
[DOM Level 2 CSS]
|
944 |
*/
|
945 |
cx.fam.suika.y2005.CSS.Node.RuleSet.prototype.getSelectorText = function () {
|
946 |
return this.selector.getSelectorText ();
|
947 |
};
|
948 |
|
949 |
/**
|
950 |
The declaration block of the rule set.
|
951 |
[DOM Level 2 CSS]
|
952 |
*/
|
953 |
cx.fam.suika.y2005.CSS.Node.RuleSet.prototype.getStyle = function () {
|
954 |
return this.style;
|
955 |
};
|
956 |
|
957 |
cx.fam.suika.y2005.CSS.Node.RuleSet.prototype.toString = function () {
|
958 |
return "[object CSSRuleSet]";
|
959 |
};
|
960 |
|
961 |
|
962 |
/**
|
963 |
Interface |CSSBlock|
|
964 |
*/
|
965 |
cx.fam.suika.y2005.CSS.Node.Block = function () {
|
966 |
cx.fam.suika.y2005.CSS.Node.Block._superclass.apply (this, arguments);
|
967 |
};
|
968 |
cx.fam.suika.y2005.CSS.Node.Block.inherits (cx.fam.suika.y2005.CSS.Node.Node);
|
969 |
|
970 |
cx.fam.suika.y2005.CSS.Node.Block.prototype.toString = function () {
|
971 |
return "[object CSSBlock]";
|
972 |
};
|
973 |
|
974 |
|
975 |
/**
|
976 |
Interface |CSSStyleDeclaration|
|
977 |
|
978 |
A |CSSStyleDeclaration| represents a CSS declaration block.
|
979 |
*/
|
980 |
cx.fam.suika.y2005.CSS.Node.StyleDeclaration = function () {
|
981 |
cx.fam.suika.y2005.CSS.Node.StyleDeclaration._superclass.apply (this, arguments);
|
982 |
this.decls = [];
|
983 |
};
|
984 |
cx.fam.suika.y2005.CSS.Node.StyleDeclaration.inherits
|
985 |
(cx.fam.suika.y2005.CSS.Node.Block);
|
986 |
cx.fam.suika.y2005.CSS.Node.StyleDeclaration.prototype.getCSSNodeType = function () {
|
987 |
return cx.fam.suika.y2005.CSS.Node.Rule.prototype.CSS_DECLARATION_BLOCK_NODE;
|
988 |
};
|
989 |
|
990 |
/**
|
991 |
Appends a CSS property declaration object.
|
992 |
[non-standard]
|
993 |
*/
|
994 |
cx.fam.suika.y2005.CSS.Node.StyleDeclaration.prototype.appendPropertyNode =
|
995 |
function (newProp) {
|
996 |
newProp.parentRule = this;
|
997 |
return this.decls.push (newProp);
|
998 |
};
|
999 |
|
1000 |
/* Not implemented: |setCSSText|, |length|, |getPropertyCSSValue|,
|
1001 |
|getPropertyPriority|, |getPropertyValue|,
|
1002 |
|removeProperty|, |setProperty| from DOM Level 2 CSS */
|
1003 |
|
1004 |
/**
|
1005 |
The textual representation of the declaration block, excluding the
|
1006 |
surrounding curly braces.
|
1007 |
[DOM Level 2 CSS]
|
1008 |
|
1009 |
Note that namespace fix up is not done.
|
1010 |
*/
|
1011 |
cx.fam.suika.y2005.CSS.Node.StyleDeclaration.prototype.getCSSText =
|
1012 |
function () {
|
1013 |
var r = "";
|
1014 |
for (var i = 0; i < this.decls.length; i++) {
|
1015 |
r += " " + this.decls[i].getCSSText () + ";\n";
|
1016 |
}
|
1017 |
return r;
|
1018 |
};
|
1019 |
|
1020 |
/**
|
1021 |
The number of declarations in the declaration block.
|
1022 |
[non-standard]
|
1023 |
*/
|
1024 |
cx.fam.suika.y2005.CSS.Node.StyleDeclaration.prototype.getDeclarationLength =
|
1025 |
function () {
|
1026 |
return this.decls.length;
|
1027 |
};
|
1028 |
|
1029 |
/**
|
1030 |
Returns the |index|th declaration in the declaration block, if any, or |null|.
|
1031 |
[non-standard]
|
1032 |
|
1033 |
@param index The index of the declaration.
|
1034 |
@return The declaration object or |null|.
|
1035 |
*/
|
1036 |
cx.fam.suika.y2005.CSS.Node.StyleDeclaration.prototype.getDeclarationNode =
|
1037 |
function (index) {
|
1038 |
return this.decls[index];
|
1039 |
};
|
1040 |
|
1041 |
/*
|
1042 |
The rule that contains this rule, if any, or |null| otherwise.
|
1043 |
[DOM Level 2 CSS]
|
1044 |
*/
|
1045 |
cx.fam.suika.y2005.CSS.Node.StyleDeclaration.prototype.getParentRule = function () {
|
1046 |
return this.parentRule;
|
1047 |
};
|
1048 |
cx.fam.suika.y2005.CSS.Node.StyleDeclaration.prototype._SetParentRule =
|
1049 |
function (newValue) {
|
1050 |
this.parentRule = newValue;
|
1051 |
};
|
1052 |
|
1053 |
cx.fam.suika.y2005.CSS.Node.StyleDeclaration.prototype.toString = function () {
|
1054 |
return "[object CSSStyleDeclaration]";
|
1055 |
};
|
1056 |
|
1057 |
|
1058 |
/**
|
1059 |
Interface |CSSDeclaration|
|
1060 |
*/
|
1061 |
cx.fam.suika.y2005.CSS.Node.Declaration = function () {
|
1062 |
cx.fam.suika.y2005.CSS.Node.Declaration._superclass.apply (this, arguments);
|
1063 |
};
|
1064 |
cx.fam.suika.y2005.CSS.Node.Declaration.inherits (cx.fam.suika.y2005.CSS.Node.Node);
|
1065 |
cx.fam.suika.y2005.CSS.Node.Declaration.prototype.getCSSNodeType = function () {
|
1066 |
return cx.fam.suika.y2005.CSS.Node.Rule.prototype.CSS_EMPTY_DECLARATION_NODE;
|
1067 |
};
|
1068 |
|
1069 |
/**
|
1070 |
The textual representation of the declaration.
|
1071 |
[non-standard]
|
1072 |
|
1073 |
Note that namespace fix up is not done.
|
1074 |
*/
|
1075 |
cx.fam.suika.y2005.CSS.Node.Declaration.prototype.getCSSText =
|
1076 |
function () {
|
1077 |
return "";
|
1078 |
};
|
1079 |
|
1080 |
cx.fam.suika.y2005.CSS.Node.Declaration.prototype.toString = function () {
|
1081 |
return "[object CSSDeclaration]";
|
1082 |
};
|
1083 |
|
1084 |
|
1085 |
/**
|
1086 |
Interface |CSSPropertyDeclaration|
|
1087 |
|
1088 |
A |CSSPropertyDeclaration| object represents a CSS declaration,
|
1089 |
i.e. a pair of property (or descriptor) name and value.
|
1090 |
*/
|
1091 |
cx.fam.suika.y2005.CSS.Node.PropertyDeclaration =
|
1092 |
function (nsURI, prefix, lname, val, pri) {
|
1093 |
cx.fam.suika.y2005.CSS.Node.PropertyDeclaration._superclass.apply (this, []);
|
1094 |
this.propertyNamespaceURI = nsURI;
|
1095 |
this.propertyPrefix = prefix != null ? prefix.toLowerCase () : null;
|
1096 |
this.propertyLocalName = lname.toLowerCase ();
|
1097 |
this.propertyValue = val;
|
1098 |
this.priority = pri;
|
1099 |
};
|
1100 |
cx.fam.suika.y2005.CSS.Node.PropertyDeclaration.inherits
|
1101 |
(cx.fam.suika.y2005.CSS.Node.Declaration);
|
1102 |
cx.fam.suika.y2005.CSS.Node.PropertyDeclaration.prototype.getCSSNodeType =
|
1103 |
function () {
|
1104 |
return cx.fam.suika.y2005.CSS.Node.Rule.prototype.CSS_PROPERTY_DECLARATION_NODE;
|
1105 |
};
|
1106 |
|
1107 |
/**
|
1108 |
The textual representation of the declaration.
|
1109 |
Note that namespace fix up is not done.
|
1110 |
[non-standard]
|
1111 |
*/
|
1112 |
cx.fam.suika.y2005.CSS.Node.PropertyDeclaration.prototype.getCSSText =
|
1113 |
function () {
|
1114 |
var r = this._EscapeIdent (this.getPropertyName ()) + ": "
|
1115 |
+ this.getPropertyValue ().getCSSText ();
|
1116 |
if (this.priority.namespaceURI == "http://suika.fam.cx/~wakaba/archive/2005/cssc." &&
|
1117 |
this.priority.localName == "normal") {
|
1118 |
//
|
1119 |
} else {
|
1120 |
r += " !" + this.priority.getCSSText ();
|
1121 |
}
|
1122 |
return r;
|
1123 |
};
|
1124 |
|
1125 |
/**
|
1126 |
The priority value of the property.
|
1127 |
*/
|
1128 |
cx.fam.suika.y2005.CSS.Node.PropertyDeclaration.prototype.getPriority =
|
1129 |
function () {
|
1130 |
return this.priority;
|
1131 |
};
|
1132 |
cx.fam.suika.y2005.CSS.Node.PropertyDeclaration.prototype.setPriority =
|
1133 |
function (newValue) {
|
1134 |
this.priority = newValue;
|
1135 |
};
|
1136 |
|
1137 |
cx.fam.suika.y2005.CSS.Node.PropertyDeclaration.prototype.getPropertyLocalName =
|
1138 |
function () {
|
1139 |
return this.propertyLocalName;
|
1140 |
};
|
1141 |
cx.fam.suika.y2005.CSS.Node.PropertyDeclaration.prototype.getPropertyName =
|
1142 |
function () {
|
1143 |
if (this.propertNamePrefix == null) {
|
1144 |
return this.propertyLocalName;
|
1145 |
} else {
|
1146 |
return "-" + this.propertyPrefix + "-" + this.propertyLocalName;
|
1147 |
}
|
1148 |
};
|
1149 |
cx.fam.suika.y2005.CSS.Node.PropertyDeclaration.prototype.getPropertyPrefix =
|
1150 |
function () {
|
1151 |
return this.propertyPrefix;
|
1152 |
};
|
1153 |
cx.fam.suika.y2005.CSS.Node.PropertyDeclaration.prototype.setPropertyPrefix =
|
1154 |
function (newValue) {
|
1155 |
this.propertyPrefix = newValue.toLowerCase ();
|
1156 |
};
|
1157 |
cx.fam.suika.y2005.CSS.Node.PropertyDeclaration.prototype.getPropertyNamespaceURI =
|
1158 |
function () {
|
1159 |
return this.propertyNamespaceURI;
|
1160 |
};
|
1161 |
cx.fam.suika.y2005.CSS.Node.PropertyDeclaration.prototype.getPropertyValue =
|
1162 |
function () {
|
1163 |
return this.propertyValue;
|
1164 |
};
|
1165 |
cx.fam.suika.y2005.CSS.Node.PropertyDeclaration.prototype.setPropertyValue =
|
1166 |
function (newValue) {
|
1167 |
this.propertyValue = newValue;
|
1168 |
};
|
1169 |
|
1170 |
cx.fam.suika.y2005.CSS.Node.PropertyDeclaration.prototype.toString = function () {
|
1171 |
return "[object CSSPropertyDeclaration]";
|
1172 |
};
|
1173 |
|
1174 |
|
1175 |
/**
|
1176 |
Interface |StyleSheetList|
|
1177 |
*/
|
1178 |
cx.fam.suika.y2005.CSS.StyleSheetList = function () {
|
1179 |
this.v = [];
|
1180 |
};
|
1181 |
|
1182 |
/**
|
1183 |
Appends a style sheet to the last of the list.
|
1184 |
[non-standard]
|
1185 |
|
1186 |
@param styleSheet The style sheet to add.
|
1187 |
@throw DOMException |NO_MODIFICATION_ALLOWED_ERR|: If the list is read-only.
|
1188 |
*/
|
1189 |
cx.fam.suika.y2005.CSS.StyleSheetList.prototype.addStyleSheet = function (styleSheet) {
|
1190 |
this.v.push (styleSheet);
|
1191 |
};
|
1192 |
|
1193 |
/**
|
1194 |
The |index|th style sheet in the list, if any, or |null| otherwise.
|
1195 |
[DOM Level 2 Style Sheet]
|
1196 |
*/
|
1197 |
cx.fam.suika.y2005.CSS.StyleSheetList.prototype.item = function (index) {
|
1198 |
return this.v[index];
|
1199 |
};
|
1200 |
|
1201 |
/**
|
1202 |
The number of style sheets in the list.
|
1203 |
[DOM Level 2 Style Sheet]
|
1204 |
*/
|
1205 |
cx.fam.suika.y2005.CSS.StyleSheetList.prototype.getLength = function () {
|
1206 |
return this.v.length;
|
1207 |
};
|
1208 |
|
1209 |
cx.fam.suika.y2005.CSS.StyleSheetList.prototype.toString = function () {
|
1210 |
return "[object StyleSheetList]";
|
1211 |
};
|
1212 |
|
1213 |
|
1214 |
/**
|
1215 |
Interface |CSSRuleList|
|
1216 |
*/
|
1217 |
cx.fam.suika.y2005.CSS.RuleList = function () {
|
1218 |
this.v = [];
|
1219 |
};
|
1220 |
|
1221 |
/**
|
1222 |
Appends a CSS rule to the list.
|
1223 |
[non-standard]
|
1224 |
|
1225 |
Note. In the current implementation this method does not set
|
1226 |
|parentRule| and |parentStyleSheet| properties; use
|
1227 |
|CSSRule.appendCSSRule| or |CSSStyleSheet.appendCSSRule|
|
1228 |
method instead.
|
1229 |
This method is intended for contexts where the |CSSRuleList| is
|
1230 |
not part of any CSS style sheet.
|
1231 |
|
1232 |
@param rule The rule to add.
|
1233 |
@throw DOMException |NO_MODIFICATION_ALLOWED_ERR|: If the list is read-only.
|
1234 |
|HIERARCHY_REQUEST_ERR|: If the type of rule is not
|
1235 |
allowed in the list.
|
1236 |
*/
|
1237 |
cx.fam.suika.y2005.CSS.RuleList.prototype.addCSSRule = function (rule) {
|
1238 |
this.v.push (rule);
|
1239 |
};
|
1240 |
|
1241 |
/**
|
1242 |
The |index|th rule in the list, if any, or |null| otherwise.
|
1243 |
[DOM Level 2 CSS]
|
1244 |
*/
|
1245 |
cx.fam.suika.y2005.CSS.RuleList.prototype.item = function (index) {
|
1246 |
return this.v[index];
|
1247 |
};
|
1248 |
|
1249 |
/**
|
1250 |
The number of rules in the list.
|
1251 |
[DOM Level 2 CSS]
|
1252 |
*/
|
1253 |
cx.fam.suika.y2005.CSS.RuleList.prototype.getLength = function () {
|
1254 |
return this.v.length;
|
1255 |
};
|
1256 |
|
1257 |
cx.fam.suika.y2005.CSS.RuleList.prototype.toString = function () {
|
1258 |
return "[object CSSRuleList]";
|
1259 |
};
|
1260 |
|
1261 |
/* Revision: $Date: 2005/11/08 13:58:50 $ */
|
1262 |
|
1263 |
/* ***** BEGIN LICENSE BLOCK *****
|
1264 |
* Copyright 2005 Wakaba <w@suika.fam.cx>. All rights reserved.
|
1265 |
*
|
1266 |
* This program is free software; you can redistribute it and/or
|
1267 |
* modify it under the same terms as Perl itself.
|
1268 |
*
|
1269 |
* Alternatively, the contents of this file may be used
|
1270 |
* under the following terms (the "MPL/GPL/LGPL"),
|
1271 |
* in which case the provisions of the MPL/GPL/LGPL are applicable instead
|
1272 |
* of those above. If you wish to allow use of your version of this file only
|
1273 |
* under the terms of the MPL/GPL/LGPL, and not to allow others to
|
1274 |
* use your version of this file under the terms of the Perl, indicate your
|
1275 |
* decision by deleting the provisions above and replace them with the notice
|
1276 |
* and other provisions required by the MPL/GPL/LGPL. If you do not delete
|
1277 |
* the provisions above, a recipient may use your version of this file under
|
1278 |
* the terms of any one of the Perl or the MPL/GPL/LGPL.
|
1279 |
*
|
1280 |
* "MPL/GPL/LGPL":
|
1281 |
*
|
1282 |
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1283 |
*
|
1284 |
* The contents of this file are subject to the Mozilla Public License Version
|
1285 |
* 1.1 (the "License"); you may not use this file except in compliance with
|
1286 |
* the License. You may obtain a copy of the License at
|
1287 |
* <http://www.mozilla.org/MPL/>
|
1288 |
*
|
1289 |
* Software distributed under the License is distributed on an "AS IS" basis,
|
1290 |
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
1291 |
* for the specific language governing rights and limitations under the
|
1292 |
* License.
|
1293 |
*
|
1294 |
* The Original Code is BIDOM code.
|
1295 |
*
|
1296 |
* The Initial Developer of the Original Code is Wakaba.
|
1297 |
* Portions created by the Initial Developer are Copyright (C) 2005
|
1298 |
* the Initial Developer. All Rights Reserved.
|
1299 |
*
|
1300 |
* Contributor(s):
|
1301 |
* Wakaba <w@suika.fam.cx>
|
1302 |
*
|
1303 |
* Alternatively, the contents of this file may be used under the terms of
|
1304 |
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
1305 |
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
1306 |
* in which case the provisions of the GPL or the LGPL are applicable instead
|
1307 |
* of those above. If you wish to allow use of your version of this file only
|
1308 |
* under the terms of either the GPL or the LGPL, and not to allow others to
|
1309 |
* use your version of this file under the terms of the MPL, indicate your
|
1310 |
* decision by deleting the provisions above and replace them with the notice
|
1311 |
* and other provisions required by the LGPL or the GPL. If you do not delete
|
1312 |
* the provisions above, a recipient may use your version of this file under
|
1313 |
* the terms of any one of the MPL, the GPL or the LGPL.
|
1314 |
*
|
1315 |
* ***** END LICENSE BLOCK ***** */
|