Bladeren bron

Merge pull request #12 from mooflu/CS_element_IDs

CS element IDs
Lloyd Weehuizen 14 jaren geleden
bovenliggende
commit
972a12408b
3 gewijzigde bestanden met toevoegingen van 3 en 8 verwijderingen
  1. 1 3
      Source/Core/Context.cpp
  2. 1 1
      Source/Core/Element.cpp
  3. 1 4
      Source/Core/ElementUtilities.cpp

+ 1 - 3
Source/Core/Context.cpp

@@ -425,15 +425,13 @@ void Context::ShowMouseCursor(bool show)
 // Returns the first document found in the root with the given id.
 ElementDocument* Context::GetDocument(const String& id)
 {
-	const String lower_id = id.ToLower();
-
 	for (int i = 0; i < root->GetNumChildren(); i++)
 	{
 		ElementDocument* document = root->GetChild(i)->GetOwnerDocument();
 		if (document == NULL)
 			continue;
 
-		if (document->GetId() == lower_id)
+		if (document->GetId() == id)
 			return document;
 	}
 

+ 1 - 1
Source/Core/Element.cpp

@@ -1306,7 +1306,7 @@ void Element::OnAttributeChange(const AttributeNameList& changed_attributes)
 {
 	if (changed_attributes.find("id") != changed_attributes.end())
 	{
-		id = GetAttribute< String >("id", "").ToLower();
+		id = GetAttribute< String >("id", "");
 		style->DirtyDefinition();
 	}
 

+ 1 - 4
Source/Core/ElementUtilities.cpp

@@ -47,15 +47,12 @@ Element* ElementUtilities::GetElementById(Element* root_element, const String& i
 	SearchQueue search_queue;
 	search_queue.push(root_element);
 
-	// Lowercase the id for searching
-	String lower_id = id.ToLower();
-	
 	while (!search_queue.empty())
 	{
 		Element* element = search_queue.front();
 		search_queue.pop();
 		
-		if (element->GetId() == lower_id)
+		if (element->GetId() == id)
 		{
 			return element;
 		}