hasSameAttribute method has been refactored.