1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_ProcessingInstruction_h
8 #define mozilla_dom_ProcessingInstruction_h
10 #include "mozilla/Attributes.h"
11 #include "mozilla/dom/CharacterData.h"
12 #include "nsAString.h"
23 class ProcessingInstruction
: public CharacterData
{
25 ProcessingInstruction(already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
,
26 const nsAString
& aData
);
28 virtual already_AddRefed
<CharacterData
> CloneDataNode(
29 dom::NodeInfo
* aNodeInfo
, bool aCloneText
) const override
;
32 virtual void List(FILE* out
, int32_t aIndent
) const override
;
33 virtual void DumpContent(FILE* out
, int32_t aIndent
,
34 bool aDumpAll
) const override
;
38 void GetTarget(nsAString
& aTarget
) { aTarget
= NodeName(); }
39 // This is the WebIDL API for LinkStyle, even though only
40 // XMLStylesheetProcessingInstruction actually implements LinkStyle.
41 StyleSheet
* GetSheetForBindings() const;
43 NS_IMPL_FROMNODE_HELPER(ProcessingInstruction
, IsProcessingInstruction())
46 virtual ~ProcessingInstruction();
49 * This will parse the content of the PI, to extract the value of the pseudo
50 * attribute with the name specified in aName. See
51 * http://www.w3.org/TR/xml-stylesheet/#NT-StyleSheetPI for the specification
52 * which is used to parse the content of the PI.
54 * @param aName the name of the attribute to get the value for
55 * @param aValue [out] the value for the attribute with name specified in
56 * aAttribute. Empty if the attribute isn't present.
58 bool GetAttrValue(nsAtom
* aName
, nsAString
& aValue
);
60 JSObject
* WrapNode(JSContext
*, JS::Handle
<JSObject
*> aGivenProto
) override
;
64 } // namespace mozilla
67 * aNodeInfoManager must not be null.
69 already_AddRefed
<mozilla::dom::ProcessingInstruction
>
70 NS_NewXMLProcessingInstruction(nsNodeInfoManager
* aNodeInfoManager
,
71 const nsAString
& aTarget
,
72 const nsAString
& aData
);
74 #endif // mozilla_dom_ProcessingInstruction_h