Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsISupports.idl" |
michael@0 | 7 | |
michael@0 | 8 | interface nsIURI; |
michael@0 | 9 | interface nsIDOMElement; |
michael@0 | 10 | interface nsIDOMDocumentFragment; |
michael@0 | 11 | |
michael@0 | 12 | /** |
michael@0 | 13 | * nsIFeedTextConstructs represent feed text fields that can contain |
michael@0 | 14 | * one of text, HTML, or XHTML. Some extension elements also have "type" |
michael@0 | 15 | * parameters, and this interface could be used there as well. |
michael@0 | 16 | */ |
michael@0 | 17 | [scriptable, uuid(fc97a2a9-d649-4494-931e-db81a156c873)] |
michael@0 | 18 | interface nsIFeedTextConstruct : nsISupports |
michael@0 | 19 | { |
michael@0 | 20 | /** |
michael@0 | 21 | * If the text construct contains (X)HTML, relative references in |
michael@0 | 22 | * the content should be resolved against this base URI. |
michael@0 | 23 | */ |
michael@0 | 24 | attribute nsIURI base; |
michael@0 | 25 | |
michael@0 | 26 | /** |
michael@0 | 27 | * The language of the text. For example, "en-US" for US English. |
michael@0 | 28 | */ |
michael@0 | 29 | attribute AString lang; |
michael@0 | 30 | |
michael@0 | 31 | /** |
michael@0 | 32 | * One of "text", "html", or "xhtml". If the type is (x)html, a '<' |
michael@0 | 33 | * character represents markup. To display that character, an escape |
michael@0 | 34 | * such as < must be used. If the type is "text", the '<' |
michael@0 | 35 | * character represents the character itself, and such text should |
michael@0 | 36 | * not be embedded in markup without escaping it first. |
michael@0 | 37 | */ |
michael@0 | 38 | attribute AString type; |
michael@0 | 39 | |
michael@0 | 40 | /** |
michael@0 | 41 | * The content of the text construct. |
michael@0 | 42 | */ |
michael@0 | 43 | attribute AString text; |
michael@0 | 44 | |
michael@0 | 45 | /** |
michael@0 | 46 | * Returns the text of the text construct, with all markup stripped |
michael@0 | 47 | * and all entities decoded. If the type attribute's value is "text", |
michael@0 | 48 | * this function returns the value of the text attribute unchanged. |
michael@0 | 49 | */ |
michael@0 | 50 | AString plainText(); |
michael@0 | 51 | |
michael@0 | 52 | /** |
michael@0 | 53 | * Return an nsIDocumentFragment containing the text and markup. |
michael@0 | 54 | */ |
michael@0 | 55 | nsIDOMDocumentFragment createDocumentFragment(in nsIDOMElement element); |
michael@0 | 56 | }; |
michael@0 | 57 |