本文整理汇总了C++中ShadowRoot::getElementById方法的典型用法代码示例。如果您正苦于以下问题:C++ ShadowRoot::getElementById方法的具体用法?C++ ShadowRoot::getElementById怎么用?C++ ShadowRoot::getElementById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShadowRoot
的用法示例。
在下文中一共展示了ShadowRoot::getElementById方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setBodyContent
TEST_F(PositionTest, NodeAsRangeLastNodeShadow)
{
const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</b>33</p>";
const char* shadowContent = "<a id='a'><content select=#two></content><content select=#one></content></a>";
setBodyContent(bodyContent);
ShadowRoot* shadowRoot = setShadowContent(shadowContent, "host");
Node* host = document().getElementById("host");
Node* n1 = document().getElementById("one");
Node* n2 = document().getElementById("two");
Node* t0 = EditingStrategy::firstChild(*host);
Node* t1 = EditingStrategy::firstChild(*n1);
Node* t2 = EditingStrategy::firstChild(*n2);
Node* t3 = EditingStrategy::lastChild(*host);
Node* a = shadowRoot->getElementById("a");
EXPECT_EQ(t0, Position::inParentBeforeNode(*n1).nodeAsRangeLastNode());
EXPECT_EQ(t1, Position::inParentBeforeNode(*n2).nodeAsRangeLastNode());
EXPECT_EQ(t1, Position::inParentAfterNode(*n1).nodeAsRangeLastNode());
EXPECT_EQ(t2, Position::inParentAfterNode(*n2).nodeAsRangeLastNode());
EXPECT_EQ(t3, Position::afterNode(host).nodeAsRangeLastNode());
EXPECT_EQ(t2, PositionInFlatTree::inParentBeforeNode(*n1).nodeAsRangeLastNode());
EXPECT_EQ(a, PositionInFlatTree::inParentBeforeNode(*n2).nodeAsRangeLastNode());
EXPECT_EQ(t1, PositionInFlatTree::inParentAfterNode(*n1).nodeAsRangeLastNode());
EXPECT_EQ(t2, PositionInFlatTree::inParentAfterNode(*n2).nodeAsRangeLastNode());
EXPECT_EQ(t1, PositionInFlatTree::afterNode(host).nodeAsRangeLastNode());
}