matcher = new Juxtaposition( [ Quantifier::optional( $matcherFactory->ident() ), new Alternative( [ $matcherFactory->urlstring( 'namespace' ), $matcherFactory->url( 'namespace' ), ] ), ] ); } public function getIndex() { return -900; } public function handlesRule( Rule $rule ) { return $rule instanceof AtRule && !strcasecmp( $rule->getName(), 'namespace' ); } protected function doSanitize( CSSObject $object ) { if ( !$object instanceof Rule || !$this->handlesRule( $object ) ) { $this->sanitizationError( 'expected-at-rule', $object, [ 'namespace' ] ); return null; } if ( $object->getBlock() !== null ) { $this->sanitizationError( 'at-rule-block-not-allowed', $object->getBlock(), [ 'namespace' ] ); return null; } if ( !$this->matcher->match( $object->getPrelude(), [ 'mark-significance' => true ] ) ) { $cv = Util::findFirstNonWhitespace( $object->getPrelude() ); if ( $cv ) { $this->sanitizationError( 'invalid-namespace-value', $cv ); } else { $this->sanitizationError( 'missing-namespace-value', $object ); } return null; } $object = $this->fixPreludeWhitespace( $object, true ); return $object; } }