Take self closing nodes into account.