From: Moritz B. <m.b...@li...> - 2015-04-17 13:38:19
|
Moin, > Weil, wie Moritz richtig bemerkt hat, die ID auch in einem anderem > Template vorkommen kann und dort etwas anderes bedeuten kann. Du hast mich leicht falsch verstanden. Das JS auf keinen Fall nach der ID filtern, sondern einzig nach der CSS-Klasse. Ziel ist, beim Einbinden des JS in Maske XYZ das JS eben gar nicht anpassen zu müssen, sondern ausschließlich Maske XYZ – durch Hinzufügen der benötigten CSS-Klassen. Das ist auch das, was Sven mit dem hier meinte: > > Du denkst immernoch in der Richtung "javascript macht aktiv etwas > > mit der Seite". Denk andersrum: "Das Javascript bietet dem > > Controller einen Dienst an". Wenn das JS so geschrieben ist, dass beim Einbinden in Maske XYZ eben nur die Maske XYZ verändert werden muss, dann ist das JS ein echter Anbieter einer _allgemeinen_ Dienstleistung. Andernfalls (wenn JS weiterhin sich darauf verlässt, dass die Maske gewisse Elemente mit hard gecodeten Namen oder IDs enthält, bleibt es eben ein speziell für einige wenige Masken entwickeltes JS, was das Einbinden unnötig erschwert. > Auf der Seite ein Event ("A" wird eingegeben) -> JS sagt zum > Controller "Schicke mir mal alle Namen in denen ein "A" vorkommt > bzw. beginnt -> JS übernimmt die Daten (JSON) verarbeitet sie und fügt > sie danach in die Seite ein. Ja klar, das geht nicht anders, das meinte Sven auch nicht. Keine Angst, das sollst du nicht ändern :) Dir auch ein schönes Wochenende. LG, mosu -- Dipl.-Inform. Moritz Bunkus Geschäftsführer/CTO LINET Services GmbH | Cyriaksring 10a | 38118 Braunschweig Tel. 0531-180508-0 | Fax 0531-180508-29 | http://www.linet-services.de LINET in den sozialen Netzwerken: https://twitter.com/linetservices | https://www.facebook.com/linetservices Wissenswertes aus der IT-Welt: http://www.linet-services.de/blog/ Geschäftsführung: Moritz Bunkus, Philip Reetz und Timo Springmann HR B 9170 Amtsgericht Braunschweig USt-IdNr. DE 259 526 516 |